aroberge / reeborg

Enhanced Karel-the-robot clone
http://reeborg.ca/reeborg.html
Other
47 stars 36 forks source link

i18n ... #261

Closed aroberge closed 7 years ago

aroberge commented 8 years ago

Instead of having to keep N different html files, one for each language, I should look at having a single one (reeborg.html?) with a language selector, and have extractible strings (via id?) - thus keeping the translation as something separate.

I could create a web page that would show the strings in English and a textarea for a translation, showing the current status, giving the option of editing the page and saving it in a format that could be sent to me. All this client-side ... with no need to install poedit or something similar. However, I should follow the norm of poedit somehow, to take care of plural forms.

aroberge commented 8 years ago

And, perhaps do the same for the Python file.... showing English, French and other version. (because some things will require processing). (Same for Javascript file?)

aroberge commented 8 years ago

Some more thoughts about design:

Use tags for translations for various file types:

For exemple

"html:reeborg world": "Reeborg's World"

would be saved in html_en.json.

Use jinja2 templates to create the various static files from the corresponding json entries. For English, we would have the following files:

Create a single html translating page which is a table with 3 columns: 1st column (read only) is the tag; 2nd is the reference implementation shown in a readonly textarea; 3rd is the proposed translation with text input in textareas. The table is created dynamically by loading a json file from an html select. Include a save button to allow to construct a new json file and save it locally on the computer. Give the possibility to load a partial translation (work in progress) in the third column; for missing values, copy the default from existing language and highlight the table cell.

aroberge commented 7 years ago

This has been largerly taken care of - with a slightly modified approach. A separate project has been started for templating language translations.