Guide: Translating your UMC without WesCamp

Discussion and development of scenarios and campaigns for the game.

Moderators: Forum Moderators, Developers

Post Reply
User avatar
James_The_Invisible
Posts: 461
Joined: October 28th, 2012, 1:58 pm
Location: Somewhere in the Northlands, fighting dark forces

Guide: Translating your UMC without WesCamp

Post by James_The_Invisible » June 8th, 2017, 9:55 am

WesCamp was once a great platform for translations of UMC but as you may know, it end up unmaintained a few years ago: (viewtopic.php?f=7&t=41629). Getting translations of your campaign/other content (to work in game) is still possible but it requires more effort from the content's author/maintainer. Since some of fellow UMC creators do not know the procedure, I have decided to put up a complete guide on this topic. So let us start.
  1. Make sure that you add-on can be translated. The wiki provides some instructions for this. You can stop reading at Getting your add-on into WesCamp as WesCamp is dead by now.
  2. Get translations template (.pot file) for your add-on. There is a tool called wmlxgettext by Nobun for this. He has written instructions on how to get and use it: viewtopic.php?f=8&t=46366#p617733.
    On Wesnoth 1.13 and later, it is shipped with Wesnoth itself and can be used from Maintenance tools GUI. Just go to data/tools, launch GUI.pyw and switch to wmlxgettext tab.
  3. Get the .pot file to translators. One of the options is to distribute it with your add-on. You can also send it to them by other means (via e-mail, PM on the forums, posting it in your add-on's thread, ...).
  4. Wait for translators to do their work.
  5. Insert translations to your add-on. You have received .po/.mo file (or both) from a translator and now what is left to do, is adding it to the add-on. .po file contains the translations in human readable form, .mo file is a compiled version actually used by Wesnoth. If you have just the .po file, read this to find out how to get the .mo file from it.
    You need to put the .mo file to translations/language/LC_MESSAGES folder in your add-on. Make sure that it is named after your textdomain (wesnoth-something) else the game will not take it into account.
    On Wesnoth 1.13.7 and later, it should be enough to insert just the .po file. The .po file should be named after the language and be placed in translations/textdomain.
  6. Upload your add-on again to the add-ons server.
And that is all. If you find any error, bad wording or outdated/wrong info, please, let me know.
Last edited by James_The_Invisible on June 17th, 2018, 2:58 pm, edited 1 time in total.

User avatar
IIIO_METAL
Posts: 116
Joined: January 18th, 2017, 5:03 pm
Location: japan

Re: Guide: Translating your UMC without WesCamp

Post by IIIO_METAL » June 9th, 2017, 6:08 am

Hello James_The_Invisible.
James_The_Invisible wrote:Make sure that you add-on can be translated. The wiki provides some instructions for this. You can stop reading at Getting your add-on into WesCamp as WesCamp is dead by now.
In order to stop reading to WesCamp, can I change translate = true of "_server.pbl" to false, or delete that line?
Creator of "Mountain Witch" & "Castle of evil spirit"

User avatar
James_The_Invisible
Posts: 461
Joined: October 28th, 2012, 1:58 pm
Location: Somewhere in the Northlands, fighting dark forces

Re: Guide: Translating your UMC without WesCamp

Post by James_The_Invisible » June 9th, 2017, 7:43 am

Both changes should have the same result because as I believe default value translate is false.

User avatar
Pentarctagon
Forum Administrator
Posts: 3517
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Guide: Translating your UMC without WesCamp

Post by Pentarctagon » June 9th, 2017, 8:44 am

Stickied, since as you mention, WesCamp is no longer active.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code

Wayirr
Posts: 57
Joined: February 11th, 2012, 3:42 pm

Re: Guide: Translating your UMC without WesCamp

Post by Wayirr » September 21st, 2017, 2:47 am

How do you make translation properly if English is not your native language?

What happens if you use your native language in *.cfg files and then create en.po with translation into English? Is there an automated way to switch places between strings in *.cfg file and *.po file if you create en.po and then decided that native language should go to $lang.po and strings from en.po should go on its place, once en translation is finalized?

User avatar
Nobun
Code Contributor
Posts: 126
Joined: May 4th, 2009, 9:28 pm
Location: Italy

Re: Guide: Translating your UMC without WesCamp

Post by Nobun » September 28th, 2017, 10:20 pm

James_The_Invisible wrote:There is a tool called WesPo by Nobun for this. Or if you have got Wesnoth 1.13, you can use Maintenance tools GUI distributed with game. Just go to data/tools, launch GUI.pyw and switch to wmlxgettext tab.
Thank for mentioning my old tool "wespo".
But I would highly discourage on using it. Python3 wmlxgettext is long way better the wespo.
(I developed both, but wespo is to be considered deprecated).
For those ones wich does NOT use wesnoth 1.13, python3 wmlxgettext can be downloaded at:
https://github.com/AncientLich/wmlxgettext-unoff
This repository is usually updated to the lastest version committed on wesnoth (the last update will be added soon).

(the python3 wmlxgettext tool is contained on the directory wmlxgettext of that repository. That directory contains also "poreorder.py" and "test" directory wich can be safetely deleted, becouse they were used for tests).


For those ones who does not use wesnoth 1.13 and who downloaded wesnoth 1.13 from my repository, no chance at the moment of using the user-friendly GUY.pyw
I know that wmlxgettext is a command-line tool, but, compared to the perl wmlxgettext, is very easy to use.

First of all, from the command prompt, go to the directory where you downloaded wmlxgettext:

Code: Select all

cd "DIRECTORY_WHERE_WMLXGETTEXT_WAS_DOWNLOADED"
cd wmlxgettext
and then run wmlxgettext

Code: Select all

python3 wmlxgettext.py --directory="path/of/your/addon" --domain="YOUR_TEXTDOMAIN" -o "EMPTY_PO_FILENAME.po" --recursive
With this simple command, wmlxgettext.py will scan all the addon (for example YOUR_CAMPAIGN) searching for you all .cfg and .lua files automaticly (the new --recursive was thinked to make the life easier for UMC authors)
  • --directory=DIRECTORY: the main directory of your addon
  • --domain=DOMAIN: the name of your textdomain
  • -o FILENAME.po: creates the empty pot file, saving it as FILANEMAME.po
  • --recursive: add this key to let wmlxgettext to scan addon directory for you
NOTE: Python 3.x must be installed in your system. If you are under windows Python3 also must be added on the path (python3 installer will do this for you, if you say so).
Wayirr wrote:How do you make translation properly if English is not your native language?

What happens if you use your native language in *.cfg files and then create en.po with translation into English? Is there an automated way to switch places between strings in *.cfg file and *.po file if you create en.po and then decided that native language should go to $lang.po and strings from en.po should go on its place, once en translation is finalized?
I don't know if anyone developed a tool to perform this kind of task. As far as I know I would say "not possible"... but I could be wrong.

Wayirr
Posts: 57
Joined: February 11th, 2012, 3:42 pm

Re: Guide: Translating your UMC without WesCamp

Post by Wayirr » September 29th, 2017, 8:28 am

If your repo is updated from main wesnoth repo, why not to download wmlgettext right from https://github.com/wesnoth/wesnoth/tree ... data/tools main repo?

User avatar
Nobun
Code Contributor
Posts: 126
Joined: May 4th, 2009, 9:28 pm
Location: Italy

Re: Guide: Translating your UMC without WesCamp

Post by Nobun » September 29th, 2017, 9:36 am

I Absolutely agree with you.
At this moment I still not added the lastest code fix (that is, instead, released on wesnoth source repository) in my own repository. Usually I do the pull request on wesnoth source at first and then I add the same fixes also in my own repository (wich is useful to take python3 wmlxgettext official documentation online)... but the last time I forgot to add the last fix also in my own repository.

I linked my repo only because it could be easier to download for a novice (you can download wmlxgettext without having to download all the wesnoth 1.13 source tarball and without cloning all the wesnoth repository wich is a bit heavy).

But it is a very good idea to download directly from wesnoth repository (wich contains the lastest approved changes... sometimes my own repository has some commits that were added to wesnoth but still not approved and under evaluation).

However python3 wmlxgettext is stored into data/utils (and not data/tools).
Inside data/tools, instead, you will find the GUI.pyw wich will allow you to use wmlxgettext without directly using the command line.

BUT... if anyone wants to download wmlxgettext from git sources, probably it could want to replace (after doing a backup) the data/tools directory and the data/utils directory contained in the wesnoth 1.12 with the one downloaded from wesnoth 1.13 sources, so he can use all the tools.

NOTE: if you want to download ONLY python3 wmlxgettext from wesnoth source code, remember also to download the "pywmlx" directory: unlike the perl version, python3 wmlxgettext is not a single-file script. It requires also the pywmlx directory to be located in the same place as the "wmlxgettext" file (pywmlx directory contains the other source files of python3 wmlxgettext script)

Wayirr
Posts: 57
Joined: February 11th, 2012, 3:42 pm

Re: Guide: Translating your UMC without WesCamp

Post by Wayirr » September 29th, 2017, 10:25 am

Not data/utils but simply utils. A bit illogical, since tools for wml were supposed to be under data/. I'm not sure if git allows to download only a single directory but it allows to reduce download tenfold if you only pull master and only latest changes

User avatar
Nobun
Code Contributor
Posts: 126
Joined: May 4th, 2009, 9:28 pm
Location: Italy

Re: Guide: Translating your UMC without WesCamp

Post by Nobun » September 29th, 2017, 1:39 pm

Not data/utils but simply utils
Uh. right. Sorry for mistype.
However it was not my decision to put wmlxgettext into "utils". As you can see, also the old perl wmlxgettext was located on utils (see, for example, wesnoth 1.12).
But there is a reason of this choice. Wmlxgettext, infact, is also used on wesnoth building process (the pot-update target, wich must be invoked on purpose, is used to update the official core pot files)

User avatar
Celtic_Minstrel
Developer
Posts: 1207
Joined: August 3rd, 2012, 11:26 pm
Contact:

Re: Guide: Translating your UMC without WesCamp

Post by Celtic_Minstrel » January 14th, 2018, 5:06 pm

Note that Wesnoth 1.13 can directly read po files, which means you don't need to have the gettext tools installed at all (for converting po to mo). The location to place these files is slightly different though; I don't quite remember off the top of my head, but I think they can just go straight in translations, or possibly translations/your-addon-name (but honestly the former seems more likely since the latter has redundant info).
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.

User avatar
James_The_Invisible
Posts: 461
Joined: October 28th, 2012, 1:58 pm
Location: Somewhere in the Northlands, fighting dark forces

Re: Guide: Translating your UMC without WesCamp

Post by James_The_Invisible » January 14th, 2018, 7:25 pm

Celtic_Minstrel wrote:Note that Wesnoth 1.13 can directly read po files
And it is written in the original post
James_The_Invisible wrote:On Wesnoth 1.13.7 and later, it should be enough to insert just the .po file.
Maybe I will remove mentions of .mo files once Wesnoth 1.14 is out.
Celtic_Minstrel wrote:The location to place these files is slightly different though
The path is correct, I tried it myself with multiple add-ons. Do note that language should be replaced with abbreviation of a language.

User avatar
octalot
Code Contributor
Posts: 203
Joined: July 17th, 2010, 7:40 pm

Re: Guide: Translating your UMC without WesCamp

Post by octalot » May 26th, 2018, 11:50 am

Recent versions of the Windows python distribution ship with "python.exe", but not "python3.exe". For those the command is just "python", and it detects whether the script is py2.7 or py3. Trying to use `python3 <script>` will report that it's not found

oooo
Posts: 5
Joined: May 14th, 2014, 12:58 pm
Location: Japan

Re: Guide: Translating your UMC without WesCamp

Post by oooo » June 17th, 2018, 2:37 pm

James_The_Invisible wrote:
January 14th, 2018, 7:25 pm
Celtic_Minstrel wrote:The location to place these files is slightly different though
The path is correct, I tried it myself with multiple add-ons. Do note that language should be replaced with abbreviation of a language.
A po file was worked in translations/textdomain_name/, but translations/language/LC_MESSAGES/ needed a mo file.

I tested on a Debian GNU/Linux.

User avatar
James_The_Invisible
Posts: 461
Joined: October 28th, 2012, 1:58 pm
Location: Somewhere in the Northlands, fighting dark forces

Re: Guide: Translating your UMC without WesCamp

Post by James_The_Invisible » June 17th, 2018, 2:48 pm

Thanks for the info, I will add it to the first post. (So that is what Celtic_Minstrel was talking about.)

Post Reply