From 5d49100db1ac204c8c1c2c6d32e707a57945d55e Mon Sep 17 00:00:00 2001 From: Bryan Berry Date: Sat, 13 Mar 2010 11:39:08 +0000 Subject: basic i18n for text works --- diff --git a/i18n/i18n.sh b/i18n/i18n.sh new file mode 100644 index 0000000..40498d7 --- /dev/null +++ b/i18n/i18n.sh @@ -0,0 +1,31 @@ +ROOT=../../ + +xgettext --from-code=UTF-8 -c ../../js/ui.kHeader.js ../../js/ui.kFooter.js js/lesson.js -o po/messages.js.pot + +sed -i 's/charset=CHARSET/charset=UTF-8/g' po/messages.js.pot + +# mark strings to translate + +../../i18n/html2po.py index.html +mv messages.po po/messages.html.pot +xgettext --from-code=UTF-8 -c ui.kHeader.js -o messages.js.pot + +# this cmd discards any messages that aren't unique and concatenates +# the rest into output file +msgcat -u po/messages.js.pot po/messages.html.pot -o po/messages.pot + +msginit -l es -i po/messages.pot -o po/messages.es.po + +# go translate the stuff! + +msgfmt po/messages.es.po -o po/messages.es.mo +# this works after i fixed the charset + +../../i18n/translate-html.py -o index.es.html + +#convert messages.es.mo to messages.js +../../i18n/mo2js.py po/messages.es.mo po/messages.es.js + +#edit index.es.html + + diff --git a/i18n/i18n.sh~ b/i18n/i18n.sh~ new file mode 100644 index 0000000..5aa69ea --- /dev/null +++ b/i18n/i18n.sh~ @@ -0,0 +1,25 @@ +ROOT=../../ + +xgettext --from-code=UTF-8 -c ../../js/ui.kHeader.js ../../js/ui.kFooter.js -o po/messages.js.pot + +sed -i 's/charset=CHARSET/charset=UTF-8/g' po/messages.js.pot + + +/html2po.py index.hml +mv messages.po messages.html.pot +xgettext --from-code=UTF-8 -c ui.kHeader.js -o messages.js.pot + +# this cmd discards any messages that aren't unique and concatenates +# the rest into output file +msgcat -u messages.js.pot messages.html.pot -o messages.pot + +msginit -l es -i messages.pot -o messages.es.po + +change charset and CONTENT-Transfer-Encoding to UTF-8 +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: UTF-8\n" + +msgfmt messages.es.po +# this works after i fixed the charset + +../translate-html.py -o index.es.html \ No newline at end of file diff --git a/lessons/2_English_animalIdentification/index.es.html b/lessons/2_English_animalIdentification/index.es.html new file mode 100644 index 0000000..1c1208a --- /dev/null +++ b/lessons/2_English_animalIdentification/index.es.html @@ -0,0 +1,61 @@ + + + + + Identifica Animales + + + + + + + + + + + + + + + + + + +
+
+ +
+ Texto para ayudar aquí +
+
+
+
+
+ ¿Qué es esto? +
+
+ +
+
+ + + + + + + + +
+
+
+
+ + diff --git a/lessons/2_English_animalIdentification/index.es.html~ b/lessons/2_English_animalIdentification/index.es.html~ new file mode 100644 index 0000000..2d2bf8a --- /dev/null +++ b/lessons/2_English_animalIdentification/index.es.html~ @@ -0,0 +1,61 @@ + + + + + Identifica Animales + + + + + + + + + + + + + + + + + + +
+
+ +
+ Texto para ayudar aquí +
+
+
+
+
+ ¿Qué es esto? +
+
+ +
+
+ + + + + + + + +
+
+
+
+ + diff --git a/lessons/2_English_animalIdentification/index.html b/lessons/2_English_animalIdentification/index.html index bf6fd9f..9f7a34e 100755 --- a/lessons/2_English_animalIdentification/index.html +++ b/lessons/2_English_animalIdentification/index.html @@ -1,7 +1,7 @@ - English_Animal Identification + English_Animal Identification @@ -28,11 +28,11 @@ -
Help text here
+
Help text here
-
What is this?
+
What is this?
diff --git a/lessons/2_English_animalIdentification/js/lesson.js b/lessons/2_English_animalIdentification/js/lesson.js index f932b4c..9585211 100755 --- a/lessons/2_English_animalIdentification/js/lesson.js +++ b/lessons/2_English_animalIdentification/js/lesson.js @@ -7,7 +7,7 @@ $(document).ready( audio: [{'name':'correct','file':'correct.ogg'}, {'name':'incorrect','file':'incorrect.ogg'} ], - image: [{'name': 'bear', 'file': 'bear.png'}, + image: [{name: 'bear', file: 'bear.png'}, {name : 'goat', file: 'goat.png'}, {name: 'tiger', file: 'tiger.png'}, {name: 'elephant', file: 'elephant.png'}, @@ -44,7 +44,13 @@ $(document).ready( var $img = $('#imgObject'); var $options = $('.option'); - + $.i18n.gettext("bear"); + $.i18n.gettext("goat"); + $.i18n.gettext("tiger"); + $.i18n.gettext("elephant"); + $.i18n.gettext("horse"); + $.i18n.gettext("cow"); + var populateListNames = function() { var i = 0; $.each(k.image, function (img){ @@ -119,7 +125,7 @@ $(document).ready( correctIndex = pickCorrect(); for (var i = 0; i < 4; i++){ - $($options[i]).text(k.image[names[i]].name); + $($options[i]).text($.i18n.gettext(k.image[names[i]].name)); } $img.attr('src', k.image[names[correctIndex]].src) diff --git a/lessons/2_English_animalIdentification/messages.mo b/lessons/2_English_animalIdentification/messages.mo new file mode 100644 index 0000000..90d729b --- /dev/null +++ b/lessons/2_English_animalIdentification/messages.mo Binary files differ diff --git a/lessons/2_English_animalIdentification/po/messages.es.js b/lessons/2_English_animalIdentification/po/messages.es.js new file mode 100644 index 0000000..d96c7ea --- /dev/null +++ b/lessons/2_English_animalIdentification/po/messages.es.js @@ -0,0 +1,30 @@ +$.i18n.es = +{ + "strings": { + "": "#-#-#-#-# messages.js.pot (PACKAGE VERSION) #-#-#-#-#\nProject-Id-Version: PACKAGE VERSION\nReport-Msgid-Bugs-To: \nPOT-Creation-Date: 2010-03-13 16:22+0545\nPO-Revision-Date: 2010-03-13 16:25+0545\nLast-Translator: hitman \nLanguage-Team: Spanish\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n#-#-#-#-# messages.html.pot (PACKAGE VERSION) #-#-#-#-#\nProject-Id-Version: PACKAGE VERSION\nPOT-Creation-Date: 2010-03-13 16:13+NPT\nPO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\nLast-Translator: FULL NAME \nLanguage-Team: LANGUAGE \nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: ENCODING\nGenerated-By: html2po.py 1.0\nPlural-Forms: nplurals=2; plural=(n != 1);\n", + "horse": "caballo", + "What is this?": "¿Qué es esto?", + "cow": "vaca", + "English_Animal Identification": "Identifica Animales", + "bear": "oso", + " Help text here": "Texto para ayudar aquí", + "tiger": "tigre", + "elephant": "elefante", + "goat": "chivo" + }, + "contextualized_strings": { + "$.ui.kHeader": { + "Teacher's Note": "Nota de Profesora", + "Lesson Plan": "Plan de Lección" + }, + "$.ui.kFooter": { + "Pause": "Pausa", + "Timer": "Reloj", + "Play Again": "Juega Otra", + "Start": "Comienza", + "Score": "Marca", + "Total": "Todo" + } + } +}; +$.i18n.setLocale('es'); diff --git a/lessons/2_English_animalIdentification/po/messages.es.mo b/lessons/2_English_animalIdentification/po/messages.es.mo new file mode 100644 index 0000000..90d729b --- /dev/null +++ b/lessons/2_English_animalIdentification/po/messages.es.mo Binary files differ diff --git a/lessons/2_English_animalIdentification/po/messages.es.po b/lessons/2_English_animalIdentification/po/messages.es.po new file mode 100644 index 0000000..68d6aeb --- /dev/null +++ b/lessons/2_English_animalIdentification/po/messages.es.po @@ -0,0 +1,112 @@ +# #-#-#-#-# messages.js.pot (PACKAGE VERSION) #-#-#-#-# +# Spanish translations for PACKAGE package. +# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# hitman , 2010. +# +# #-#-#-#-# messages.html.pot (PACKAGE VERSION) #-#-#-#-# +# Spanish translations for PACKAGE package. +# Copyright (C) 2010 ORGANIZATION +# hitman , 2010. +# +msgid "" +msgstr "" +"#-#-#-#-# messages.js.pot (PACKAGE VERSION) #-#-#-#-#\n" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-03-13 16:22+0545\n" +"PO-Revision-Date: 2010-03-13 16:25+0545\n" +"Last-Translator: hitman \n" +"Language-Team: Spanish\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"#-#-#-#-# messages.html.pot (PACKAGE VERSION) #-#-#-#-#\n" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-03-13 16:13+NPT\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: ENCODING\n" +"Generated-By: html2po.py 1.0\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: ../../js/ui.kHeader.js:63 +msgctxt "$.ui.kHeader" +msgid "Lesson Plan" +msgstr "Plan de Lección" + +#: ../../js/ui.kHeader.js:71 +msgctxt "$.ui.kHeader" +msgid "Teacher's Note" +msgstr "Nota de Profesora" + +#: ../../js/ui.kFooter.js:193 +msgctxt "$.ui.kFooter" +msgid "Score" +msgstr "Marca" + +#: ../../js/ui.kFooter.js:198 +msgctxt "$.ui.kFooter" +msgid "Total" +msgstr "Todo" + +#: ../../js/ui.kFooter.js:211 +msgctxt "$.ui.kFooter" +msgid "Timer" +msgstr "Reloj" + +#: ../../js/ui.kFooter.js:235 +msgctxt "$.ui.kFooter" +msgid "Play Again" +msgstr "Juega Otra" + +#: ../../js/ui.kFooter.js:250 +msgctxt "$.ui.kFooter" +msgid "Pause" +msgstr "Pausa" + +#: ../../js/ui.kFooter.js:265 +msgctxt "$.ui.kFooter" +msgid "Start" +msgstr "Comienza" + +#. var i = 0; +#. $.each(k.image, function (img){ +#. names[i] = img; +#. i++; +#. }); +#: js/lesson.js:54 +msgid "bear" +msgstr "oso" + +#: js/lesson.js:54 +msgid "goat" +msgstr "chivo" + +#: js/lesson.js:55 +msgid "tiger" +msgstr "tigre" + +#: js/lesson.js:55 +msgid "elephant" +msgstr "elefante" + +#: js/lesson.js:56 +msgid "horse" +msgstr "caballo" + +#: js/lesson.js:56 +msgid "cow" +msgstr "vaca" + +msgid " Help text here" +msgstr "Texto para ayudar aquí" + +msgid "English_Animal Identification" +msgstr "Identifica Animales" + +msgid "What is this?" +msgstr "¿Qué es esto?" diff --git a/lessons/2_English_animalIdentification/po/messages.es.po~ b/lessons/2_English_animalIdentification/po/messages.es.po~ new file mode 100644 index 0000000..e204a26 --- /dev/null +++ b/lessons/2_English_animalIdentification/po/messages.es.po~ @@ -0,0 +1,112 @@ +# #-#-#-#-# messages.js.pot (PACKAGE VERSION) #-#-#-#-# +# Spanish translations for PACKAGE package. +# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# hitman , 2010. +# +# #-#-#-#-# messages.html.pot (PACKAGE VERSION) #-#-#-#-# +# Spanish translations for PACKAGE package. +# Copyright (C) 2010 ORGANIZATION +# hitman , 2010. +# +msgid "" +msgstr "" +"#-#-#-#-# messages.js.pot (PACKAGE VERSION) #-#-#-#-#\n" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-03-13 16:22+0545\n" +"PO-Revision-Date: 2010-03-13 16:25+0545\n" +"Last-Translator: hitman \n" +"Language-Team: Spanish\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"#-#-#-#-# messages.html.pot (PACKAGE VERSION) #-#-#-#-#\n" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-03-13 16:13+NPT\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: ENCODING\n" +"Generated-By: html2po.py 1.0\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: ../../js/ui.kHeader.js:63 +msgctxt "$.ui.kHeader" +msgid "Lesson Plan" +msgstr "" + +#: ../../js/ui.kHeader.js:71 +msgctxt "$.ui.kHeader" +msgid "Teacher's Note" +msgstr "" + +#: ../../js/ui.kFooter.js:193 +msgctxt "$.ui.kFooter" +msgid "Score" +msgstr "" + +#: ../../js/ui.kFooter.js:198 +msgctxt "$.ui.kFooter" +msgid "Total" +msgstr "" + +#: ../../js/ui.kFooter.js:211 +msgctxt "$.ui.kFooter" +msgid "Timer" +msgstr "" + +#: ../../js/ui.kFooter.js:235 +msgctxt "$.ui.kFooter" +msgid "Play Again" +msgstr "" + +#: ../../js/ui.kFooter.js:250 +msgctxt "$.ui.kFooter" +msgid "Pause" +msgstr "" + +#: ../../js/ui.kFooter.js:265 +msgctxt "$.ui.kFooter" +msgid "Start" +msgstr "" + +#. var i = 0; +#. $.each(k.image, function (img){ +#. names[i] = img; +#. i++; +#. }); +#: js/lesson.js:54 +msgid "bear" +msgstr "" + +#: js/lesson.js:54 +msgid "goat" +msgstr "" + +#: js/lesson.js:55 +msgid "tiger" +msgstr "" + +#: js/lesson.js:55 +msgid "elephant" +msgstr "" + +#: js/lesson.js:56 +msgid "horse" +msgstr "" + +#: js/lesson.js:56 +msgid "cow" +msgstr "" + +msgid " Help text here" +msgstr "" + +msgid "English_Animal Identification" +msgstr "" + +msgid "What is this?" +msgstr "" diff --git a/lessons/2_English_animalIdentification/po/messages.html.pot b/lessons/2_English_animalIdentification/po/messages.html.pot new file mode 100644 index 0000000..7c0fa9c --- /dev/null +++ b/lessons/2_English_animalIdentification/po/messages.html.pot @@ -0,0 +1,26 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-03-13 16:13+NPT\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: ENCODING\n" +"Generated-By: html2po.py 1.0\n" + + +msgid " Help text here" +msgstr "" + +msgid "English_Animal Identification" +msgstr "" + +msgid "What is this?" +msgstr "" + diff --git a/lessons/2_English_animalIdentification/po/messages.js.pot b/lessons/2_English_animalIdentification/po/messages.js.pot new file mode 100644 index 0000000..0f0929c --- /dev/null +++ b/lessons/2_English_animalIdentification/po/messages.js.pot @@ -0,0 +1,86 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-03-13 16:22+0545\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../js/ui.kHeader.js:63 +msgctxt "$.ui.kHeader" +msgid "Lesson Plan" +msgstr "" + +#: ../../js/ui.kHeader.js:71 +msgctxt "$.ui.kHeader" +msgid "Teacher's Note" +msgstr "" + +#: ../../js/ui.kFooter.js:193 +msgctxt "$.ui.kFooter" +msgid "Score" +msgstr "" + +#: ../../js/ui.kFooter.js:198 +msgctxt "$.ui.kFooter" +msgid "Total" +msgstr "" + +#: ../../js/ui.kFooter.js:211 +msgctxt "$.ui.kFooter" +msgid "Timer" +msgstr "" + +#: ../../js/ui.kFooter.js:235 +msgctxt "$.ui.kFooter" +msgid "Play Again" +msgstr "" + +#: ../../js/ui.kFooter.js:250 +msgctxt "$.ui.kFooter" +msgid "Pause" +msgstr "" + +#: ../../js/ui.kFooter.js:265 +msgctxt "$.ui.kFooter" +msgid "Start" +msgstr "" + +#. var i = 0; +#. $.each(k.image, function (img){ +#. names[i] = img; +#. i++; +#. }); +#: js/lesson.js:54 +msgid "bear" +msgstr "" + +#: js/lesson.js:54 +msgid "goat" +msgstr "" + +#: js/lesson.js:55 +msgid "tiger" +msgstr "" + +#: js/lesson.js:55 +msgid "elephant" +msgstr "" + +#: js/lesson.js:56 +msgid "horse" +msgstr "" + +#: js/lesson.js:56 +msgid "cow" +msgstr "" diff --git a/lessons/2_English_animalIdentification/po/messages.pot b/lessons/2_English_animalIdentification/po/messages.pot new file mode 100644 index 0000000..2ee68aa --- /dev/null +++ b/lessons/2_English_animalIdentification/po/messages.pot @@ -0,0 +1,112 @@ +# #-#-#-#-# messages.js.pot (PACKAGE VERSION) #-#-#-#-# +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +# #-#-#-#-# messages.html.pot (PACKAGE VERSION) #-#-#-#-# +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"#-#-#-#-# messages.js.pot (PACKAGE VERSION) #-#-#-#-#\n" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-03-13 16:22+0545\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"#-#-#-#-# messages.html.pot (PACKAGE VERSION) #-#-#-#-#\n" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-03-13 16:13+NPT\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: ENCODING\n" +"Generated-By: html2po.py 1.0\n" + +#: ../../js/ui.kHeader.js:63 +msgctxt "$.ui.kHeader" +msgid "Lesson Plan" +msgstr "" + +#: ../../js/ui.kHeader.js:71 +msgctxt "$.ui.kHeader" +msgid "Teacher's Note" +msgstr "" + +#: ../../js/ui.kFooter.js:193 +msgctxt "$.ui.kFooter" +msgid "Score" +msgstr "" + +#: ../../js/ui.kFooter.js:198 +msgctxt "$.ui.kFooter" +msgid "Total" +msgstr "" + +#: ../../js/ui.kFooter.js:211 +msgctxt "$.ui.kFooter" +msgid "Timer" +msgstr "" + +#: ../../js/ui.kFooter.js:235 +msgctxt "$.ui.kFooter" +msgid "Play Again" +msgstr "" + +#: ../../js/ui.kFooter.js:250 +msgctxt "$.ui.kFooter" +msgid "Pause" +msgstr "" + +#: ../../js/ui.kFooter.js:265 +msgctxt "$.ui.kFooter" +msgid "Start" +msgstr "" + +#. var i = 0; +#. $.each(k.image, function (img){ +#. names[i] = img; +#. i++; +#. }); +#: js/lesson.js:54 +msgid "bear" +msgstr "" + +#: js/lesson.js:54 +msgid "goat" +msgstr "" + +#: js/lesson.js:55 +msgid "tiger" +msgstr "" + +#: js/lesson.js:55 +msgid "elephant" +msgstr "" + +#: js/lesson.js:56 +msgid "horse" +msgstr "" + +#: js/lesson.js:56 +msgid "cow" +msgstr "" + +msgid " Help text here" +msgstr "" + +msgid "English_Animal Identification" +msgstr "" + +msgid "What is this?" +msgstr "" -- cgit v0.9.1