2014-02-08 14:13:59 +01:00
HOWTO TRANSLATE
===================
2014-09-27 13:15:30 +02:00
**NOTE TO DEVELOPERS**:
2014-02-08 14:13:59 +01:00
- all strings sent to the page must go through the javascript function _() which will translate it. so please, if you add new strings, wrap them with _('') function.
- if you want to add some strings in the css (using content), please, edit /script/localization.js too
- thank you :)
ADD A NEW LANGUAGE
======================
2014-09-27 13:15:30 +02:00
Required tools:
2014-02-08 14:13:59 +01:00
2014-09-27 13:15:30 +02:00
ubuntu:
apt-get install gettext
apt-get install poedit
apt-get install python
windows:
windows: http://poedit.net/
https://www.python.org/download/windows/
2014-11-10 22:50:19 +01:00
- create a new directory lang/{new_language_code}
- download the file adarkroom.pot in the lang folder as translation template
2014-09-27 13:15:30 +02:00
- create the new po file:
ubuntu:
msginit --locale {locale for new language eg: en_US} -i lang/adarkroom.pot -o lang/{new_language}/strings.po
windows:
2014-11-10 22:50:19 +01:00
open application interface > File > New... > [select language for translation] > Save as... > lang/{new_language_code}/strings.po
[update from POT file] > select lang/adarkroom.pot
2014-09-27 13:15:30 +02:00
- copy lang/main.css to lang/{new_language}
- open lang/{new_language}/strings.po with a software poedit
2014-02-08 14:13:59 +01:00
- translate ...
- keep translating ...
- finished ? sure ?
- use the python script (/tools/po2js.py) to convert the po file to a js file
2014-09-27 13:15:30 +02:00
python tools/po2js.py lang/{new_language}/strings.po
2014-02-08 14:13:59 +01:00
2014-09-27 13:15:30 +02:00
- edit README.md and add the following string: [{new_language_name}](http://adarkroom.doublespeakgames.com/?lang={new_language_code})
- edit lang/langs.js and add the new language
2014-02-08 14:13:59 +01:00
- if your sentence are too big and you need to update some css, overload it in /lang/{new_language}/main.css
2014-09-27 13:15:30 +02:00
UPDATE TEMPLATEFILE
======================
When new content or changes in the code introduce new strings the file lang/adarkroom.pot must be updated.
Required tools:
ubuntu:
apt-get install python3-babel
windows:
poedit
- ubuntu:
2014-10-13 17:30:28 +02:00
pybabel extract -F babel.cfg -c "TRANSLATORS" script > lang/adarkroom.pot
2014-09-27 13:15:30 +02:00
windows:
use poedit
Use menu "Cataloge"-> "New Catalog from POT file..."
UPDATE LANGUAGE AFTER UPDATE
===============================
Required tools:
ubuntu:
* gettext
windows:
* poedit
- ubuntu:
msgmerge -U lang/{language}/strings.po lang/adarkroom.pot
windows:
Open lang/{language}strings.po in poedit
Use menu "Cataloge"-> "Update from POT file..."
OR
After "SETUP POEDIT"
Use menu "Cataloge"-> "Update from source"
- Edit in poedit as in "ADD A NEW LANGUAGE"
SETUP POEDIT
=================
To update from source without pot file need:
- Create new parser:
File > Preferences > Parsers > New
Language:
JS
List of extension:
*.js
Parser command:
2014-10-13 17:30:28 +02:00
xgettext --language=JavaScript --force-po --add-comments=TRANSLATORS -o %o %C %K %F
2014-09-27 13:15:30 +02:00
Item in Keyword List:
-k%k
Item in input files list:
%f
Source code charset:
--from-code=%c