Line 45: |
Line 45: |
| {"language": "Simplified Chinese", "code": "zh-cn"}, | | {"language": "Simplified Chinese", "code": "zh-cn"}, |
| {"language": "Traditional Chinese", "code": "zh-tw"} | | {"language": "Traditional Chinese", "code": "zh-tw"} |
− | </syntaxhighlight>There is some "disagreement" on the codes - e.g. Hebrew was "he", but should be "il", Japanese should be "Jp" but was "ja". Danish was "da" - should be "dk". A couple of others as well. And the Chinese ones seem to have a number of variations. The major european languages are fully covered, but the others not so much. | + | </syntaxhighlight>There is some "disagreement" on the codes - e.g. Hebrew was "he", but should be "il", Japanese should be "Jp" but was "ja". Danish was "da" - should be "dk". A couple of others as well. And the Chinese ones seem to have a number of variations. The translation for the major European languages are fully covered, but the others not so much. |
| | | |
| ==== Weblate ==== | | ==== Weblate ==== |
− | '''Weblate''' is a Python based web application that has been around for at least 6 years and is well described here: https://docs.weblate.org/en/latest/admin/install.html It has a github repo : https://github.com/WeblateOrg/weblate/ and there is active support from at least one maintainer. | + | '''Weblate''' is a Python based web application that has been around for at least 6 years and is well described here: https://docs.weblate.org/en/latest/admin/install.html It has a github repo : https://github.com/WeblateOrg/weblate/ and there is active support from at least one maintainer. Apparently Rocket Chat use it, plus a number of other "well known" developments. |
| | | |
| It provides what I presume is the usual opportunities for manual and automatic language translation, and has a project / component structure. | | It provides what I presume is the usual opportunities for manual and automatic language translation, and has a project / component structure. |
Line 54: |
Line 54: |
| It provides a number of different formats for input of the text to be translated, but not ".lex" files. I have written a python program to convert them to .po files which are well supported. | | It provides a number of different formats for input of the text to be translated, but not ".lex" files. I have written a python program to convert them to .po files which are well supported. |
| | | |
− | Weblate can interact directly with the Gitea/git VCS and uses its own git VCS to hold the local files. | + | Weblate can interact directly with the Gitea/git VCS and uses its own git VCS to hold the local files. It can write any changes back to the remote VCS and/or (for Gitea) write it as a pull reqauest. allowing some oversight before changes are applied. I'#ve not got this to work yet, due almost certainly to my own lack of real understanding of certificates and public/priuvate keys and tokens. It can read the data from Gitea with no problem, and can create the translation components needed semi-automatically. |
| | | |
| ==== The PO Files ==== | | ==== The PO Files ==== |
Line 65: |
Line 65: |
| | | |
| ==== The Lex Files ==== | | ==== The Lex Files ==== |
− | The lex files only include the key string and the translated text.<syntaxhighlight lang="perl"> | + | The lex files only include the key string and the translated text, which means my python program (lex2po) has to read both the lex file for a specific language and match the key field with the same in the English lex file to get the original text. <syntaxhighlight lang="perl"> |
| 'dom_FORM_TITLE' => 'Gestion des domaines', | | 'dom_FORM_TITLE' => 'Gestion des domaines', |
| 'dom_FORM_DESCRIPTION' => ' Si vous créez un domaine, le serveur pourra recevoir des courriels et héberger un site Web pour ce domaine.', | | 'dom_FORM_DESCRIPTION' => ' Si vous créez un domaine, le serveur pourra recevoir des courriels et héberger un site Web pour ce domaine.', |
Line 103: |
Line 103: |
| | | |
| ==== Panels ==== | | ==== Panels ==== |
− | Within each Mojo controller file (usually <panelname>.pm held in /usr/share/smanager/lib/SrvMngr/Controller/). any strings to be translated are expressed using the lexicon routine "l". As here:<syntaxhighlight lang="perl"> | + | Within each Mojo controller file (usually <panelname>.pm held in /usr/share/smanager/lib/SrvMngr/Controller/), any strings to be translated are expressed using the lexicon routine "l". As here:<syntaxhighlight lang="perl"> |
| $notif = $c->l("bac_BACKUP_DESKTOP_TOO_BIG") | | $notif = $c->l("bac_BACKUP_DESKTOP_TOO_BIG") |
− | </syntaxhighlight>Simllarily in the template files (/usr/share/smanager/themes/default/templates/partials/)<syntaxhighlight lang="perl"> | + | </syntaxhighlight>Similarly in the template files (/usr/share/smanager/themes/default/templates/partials/)<syntaxhighlight lang="perl"> |
| <th class='sme-border'> | | <th class='sme-border'> |
| %=l 'dom_LABEL_NAMESERVERS' | | %=l 'dom_LABEL_NAMESERVERS' |
| </th> | | </th> |
| | | |
− | </syntaxhighlight> | + | </syntaxhighlight>clearly then the lexicon routines identifies the "local" language and returns the locally translated string. If the key passed thrugh does not match then the key itself is returned. |
| | | |
| ==== The Navigation menu ==== | | ==== The Navigation menu ==== |
Line 124: |
Line 124: |
| manual=panel|Description|Manuel en ligne|DescriptionWeight|100|Heading|Support|HeadingWeight|0000|MenuCat|N | | manual=panel|Description|Manuel en ligne|DescriptionWeight|100|Heading|Support|HeadingWeight|0000|MenuCat|N |
| | | |
− | </syntaxhighlight>The other parameters describe the heading and posiion in the menu, and are driven from the header on the controller file. | + | </syntaxhighlight>The other parameters describe the heading and position in the menu, and are driven from the header on the controller file. |
| | | |
− | The DBs are created by another part of the smanager-refresh, specifically the SrvMgr.pm (in the /usr/share/smanager/lib/ directory). And it uses a category of lex files found under the "General" directory in the I18M/Modules directory. For some reason the Lex files in the General category do not have the prefix on the key string (so $c->l("Save") works). For each menu entry it uses both the General lex file (actually the equivalent .pm file) and also | + | The DBs are created by a part of the smanager-refresh, specifically the /etc/e-smith/events/actions/navigation2-conf. And it uses a category of lex files found under the "General" directory in the I18M/Modules directory.These Lex files in the General category do not have the prefix on the key string (so $c->l("Save") works). For each menu entry it uses the General lex file (actually the equivalent .pm file) to resolve the translation of the "description" and the "heading" in the controller file and slots it into the navigation2.<langCode> file. |
| + | |
| + | The General .lex file will need to be converted to a .po file in order to be translatable by Weblate. |
| | | |
| ==== Testing in a Chromium based Browser ==== | | ==== Testing in a Chromium based Browser ==== |
| + | There is a plugin for the Chrome / Chromium browser called "Locale Switcher" which will allow you to switch between locale(s) and test the translations. |
| + | |
| + | === Converting back to .lex (or .pm) files. === |
| + | The original converted .lex files (as .po files) are saved in a pofiles directory /usr/share/smanager/lib/I18n/Modules/<whatever>/pofiles. These have been uploaded to the Git repo for smeserver-manager-locale. These will be updated through Weblate and then converted back to the .pm files. The Pull request for each change or set of changes will be created by Weblate and then acted upon by a moderator and then the .pm files re-generated and incorporated into an rpm for testing and subsequent release. |