Translation

From ago control wiki
(Difference between revisions)
Jump to: navigation, search
(Translation of ago control)
(Example of device translation)
Line 11: Line 11:
  
 
So it will show "OFF" when the state is set accordingly. After .po merge by the built or manual triggering, this becomes:
 
So it will show "OFF" when the state is set accordingly. After .po merge by the built or manual triggering, this becomes:
 +
<pre>
 
  <ko opts="ifnot: state ">
 
  <ko opts="ifnot: state ">
 
         <span data-translateable="true">OFF</span>
 
         <span data-translateable="true">OFF</span>
Line 17: Line 18:
 
         <span xml:lang="nl" data-translateable="true">UIT</span>
 
         <span xml:lang="nl" data-translateable="true">UIT</span>
 
  </ko>
 
  </ko>
 
+
</pre>
 
For each language you will get the "xml:lang" records with the translated content.  
 
For each language you will get the "xml:lang" records with the translated content.  
  

Revision as of 09:21, 14 June 2014

Contents

Translation of ago control

Core translation files for RPC Interface

Template files with translation have a special syntax, so don't just copy a "translated" html to a .in.html. Always take a .in.html as template if you want to add a new file. During the build, they're merged with the .po files into the .html files. You need to base your work on a .in.html file only. The .in.html has text bindings which will be translated.

Example of device translation

If you have a look at [1] we have this:

<ko opts="if: state() == 0">
        <_span data-translateable="true">OFF</_span>
</ko>

So it will show "OFF" when the state is set accordingly. After .po merge by the built or manual triggering, this becomes:

 <ko opts="ifnot: state ">
         <span data-translateable="true">OFF</span>
         <span xml:lang="de" data-translateable="true">AUS</span>
         <span xml:lang="fr" data-translateable="true">OFF</span>
         <span xml:lang="nl" data-translateable="true">UIT</span>
 </ko>

For each language you will get the "xml:lang" records with the translated content.

translation inside Tags

<input data-translateable="true" placeholder="Your text to translate"></input>

Adding translation for template

we have a POTFILES.in in the core/rpc/html/po directory, this lists all files that should be handled during translation. You are perhaps confused about the naming "templates/devices/switch.xml.in". You just need to rename your real template name "templates/devices/switch.in.html" to "templates/devices/switch.xml.in". This is by design and perhaps we will find some more nice way in future.

After you included your template for translation you need to trigger the translation scripts to get the .po and .pot file filled with the "requested" translation. You now can have a look into for e.g. de.po and you will find - mostly at the end - missing translations:

#: ../plugins/zwave/templates/zwaveConfig.xml.in.h:69
msgid "Reset controller"
msgstr ""

Or even "automatic" translation which may be fuzzy:

#: ../plugins/zwave/templates/zwaveConfig.xml.in.h:70
#, fuzzy
msgid "Download configuration"
msgstr "Raum Konfiguration"

Your translation will start in the "msgstr" lines. Please mind the original text - not to loose some special chars or something like this. After you are finished with your local translation you need to run the merge translations script to see the result.


Trigger manual translation

You can trigger this merge for tests on your dev server with this two commands: http://git.agocontrol.com/agocontrol/agocontrol/blob/master/core/rpc/html/updatetranslations.sh http://git.agocontrol.com/agocontrol/agocontrol/blob/master/core/rpc/html/mergetranslations.sh

cd core/rpc/html/
sh updatetranslations.sh
sh mergetranslations.sh

Note: You will need the packages realpath and intltool installed for this

Add new language

If you want to add a new language you can copy an existing .po file to your language code. If you have any questions or problems at this point contact us at IRC #agocontrol-devel on the freenode.net.

Development note

If you might want to point agorpc to your git checkout directory you can change the option in conf.d/rpc.conf:

[rpc]
htdocs=/opt/agocontrol/html
Personal tools