BGforge translation system. Language-specific forums for translators are inside.
User avatar
Site Admin
Posts: 252
Joined: Mon Nov 21, 2016 9:13 am

How to prepare a WeiDU mod for translation

Post by Magus » Sun Dec 03, 2017 11:10 am

If you want to translate a mod at BGforge, it will require some preparation.

First thing you should note is that once you offload translations to BGforge, you will no longer be able to edit them directly. All new translations will have to be added through web interface. No mix and match.
(But you can disconnect and go back to manual translation later, should you change your mind).

Second, you will need to use a version controlled hosting for the mod. Github, Bitbucket, any other git (or even mercurial, subversion) hosting will do. Easiest to use is Github.

Once you have that, you can start preparing the mod. That basically boils down to having proper file and directory names and correct encodings. Because Weblate cannot guess those things, you should follow the convention to provide this info.
If you're having problems with these instructions, refer to Ascension repo for live example. If still not clear, ask on forum.

1. Dedicate a separate directory to translations. It could be "tra", or "language", or anything else. Just don't store other stuff in that directory.

Code: Select all

2. Name language directories per WeiDU infer_charsets convention, using the english version. Not "american", but "english". Not "italiano", but "italian". Example:

Code: Select all

3. Move all WeiDU setup strings (components names, etc - everything printed to console during installation) into a separate file. It must be called either "setup.tra" or "install.tra".

4. Ensure that all EE-only strings are stored in files ending with "_ee.tra" or named "ee.tra" AND they are encoded in UTF-8.

Code: Select all

5. Ensure that all remaning files are using proper encoding, as per WeiDU documentation.
Special note: setup.tra/install.tra in Russian must be in cp866, not cp1251.

6. Ensure that all existing translations are actual:
- There are no, say, english strings in french tra files
- There are no outdated strings (when a source language string was updated, but translation was not).
Delete any such strings.

6. Create a .bgforge.yml file. It shows where the translation files should be found. The two directives are "tra_dir" (directory with translations) and "src_lang" (source language). Defaults values are "tra" and "english". If your values differ from defaults, you need to specify them in the config.

Code: Select all

  tra_dir:  ascension/lang  # if this is just "tra", you don't need to specify it
  src_lang: russian         # if this is "english", you don't need to specify it       
7. In git repo settings, add bgforge-weblate (github) user as a collaborator. Also, add a hook to notify the translation system about new strings. The url is

8. Create a request topic here, specifying mod name and repo url.


If you don't have existing translations, you're done. Wait for a member of BGforge staff to respond.


If you do have existing translations, you can also stop here and wait.

Alternatively, you could speed up the process by loading your existing translations into Gettext PO, which is what Weblate uses internally. This is done with BGforge PO tools.

9. Check .bgforge.yml:

Code: Select all

$ cd Ascension
$ cat .bgforge.yml
  tra_dir = ascension/lang  
10. Generate POT (PO file template) from source language:

Code: Select all

$ poify
Found directory ascension/lang/english
processing ascension.tra
processing balth.tra
processing balth2.tra
processing ee.tra
processing finbodh.tra
processing finmel01.tra
processing finsarev.tra
processing finsol01.tra
processing imoen25j.tra
processing imoen25p.tra
processing irenic2.tra
processing meliss01.tra
processing player1.tra
processing ppguy02.tra
processing sarev25j.tra
processing setup.tra
processing shawnesepilogues.tra
processing shawnesepilogues_ee.tra
processing solar.tra
Processed directory ascension/lang/english with encoding cp1252, the result is in ascension/lang/po/english.po        
11. Create a PO file, load an existing translation into it:

Code: Select all

$ cd ascension/lang
$ cp po/english.pot po/russian.po
$ dir2msgstr -s russian -o po/russian.po --ext tra
processing ascension.tra with encoding cp1251
processing balth.tra with encoding cp1251
processing balth2.tra with encoding cp1251
processing ee.tra with encoding utf-8
processing finbodh.tra with encoding cp1251
processing finmel01.tra with encoding cp1251
processing finsarev.tra with encoding cp1251
processing finsol01.tra with encoding cp1251
processing imoen25j.tra with encoding cp1251
processing imoen25p.tra with encoding cp1251
processing irenic2.tra with encoding cp1251
processing meliss01.tra with encoding cp1251
processing player1.tra with encoding cp1251
processing ppguy02.tra with encoding cp1251
processing sarev25j.tra with encoding cp1251
processing setup.tra with encoding cp866
processing shawnesepilogues.tra with encoding cp1251
processing shawnesepilogues_ee.tra with encoding utf-8
processing solar.tra with encoding cp1251
Processed directory russian, the result is in po/russian.po        
Repeat 11) for other languages (existing translations). If you encounter any issues in the process, it's probably because the steps 1-8 were not followed closely. Re-check that. If you still can't find the problem, feel free to file an issue on Github.

This additional process will allow for faster adding of your mod to BGforge translation system. But it's not necessary, you can stop at step 8 if you want.
Please do not PM or email me about my mods and projects. Use forums. Also, see our talk channels.

User avatar
Site Admin
Posts: 252
Joined: Mon Nov 21, 2016 9:13 am

Re: How to prepare a WeiDU mod for translation

Post by Magus » Tue Jul 23, 2019 4:15 pm

Note: we are now using yaml instead of ini, see the updated instruction.
Please do not PM or email me about my mods and projects. Use forums. Also, see our talk channels.