Guide: Translating your UMC without WesCamp
Moderator: Forum Moderators
- James_The_Invisible
- Posts: 537
- Joined: October 28th, 2012, 1:58 pm
- Location: Somewhere in the Northlands, fighting dark forces
- Contact:
Guide: Translating your UMC without WesCamp
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.
- Make sure that you add-on can be translated. The wiki provides some instructions for this.
- Get translations template (.pot file) for your add-on. Since Wesnoth 1.13 you can use Maintenance tools GUI (shipped with Wesnoth) for this. Just go to data/tools, launch GUI.pyw and switch to wmlxgettext tab.
In order to use the GUI.pyw script, you need to have Python 3 installed. If it is not pre-installed on your OS (like e. g. on Windows), you will need to download it from https://www.python.org/downloads/.
If you create for older versions of Wesnoth, you have to use an external 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. - 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, ...).
- Wait for translators to do their work.
- 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. 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.
If you create for older versions and 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. - Upload your add-on again to the add-ons server.
Last edited by James_The_Invisible on February 27th, 2022, 2:47 pm, edited 3 times in total.
My content: For Power series
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
- IIIO_METAL
- Posts: 202
- Joined: January 18th, 2017, 5:03 pm
- Location: japan
Re: Guide: Translating your UMC without WesCamp
Hello James_The_Invisible.
In order to stop reading to WesCamp, can I change translate = true of "_server.pbl" to false, or delete that line?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.
Creator of "Mountain Witch" & "Castle of evil spirit"
- James_The_Invisible
- Posts: 537
- Joined: October 28th, 2012, 1:58 pm
- Location: Somewhere in the Northlands, fighting dark forces
- Contact:
Re: Guide: Translating your UMC without WesCamp
Both changes should have the same result because as I believe default value translate is false.
My content: For Power series
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
- Pentarctagon
- Project Manager
- Posts: 5581
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Guide: Translating your UMC without WesCamp
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
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: Guide: Translating your UMC without WesCamp
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?
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?
Re: Guide: Translating your UMC without WesCamp
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
Code: Select all
python3 wmlxgettext.py --directory="path/of/your/addon" --domain="YOUR_TEXTDOMAIN" -o "EMPTY_PO_FILENAME.po" --recursive
- --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
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 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?
Re: Guide: Translating your UMC without WesCamp
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?
Re: Guide: Translating your UMC without WesCamp
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)
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)
Re: Guide: Translating your UMC without WesCamp
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
Re: Guide: Translating your UMC without WesCamp
Uh. right. Sorry for mistype.Not data/utils but simply utils
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)
- Celtic_Minstrel
- Developer
- Posts: 2258
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Guide: Translating your UMC without WesCamp
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).
- James_The_Invisible
- Posts: 537
- Joined: October 28th, 2012, 1:58 pm
- Location: Somewhere in the Northlands, fighting dark forces
- Contact:
Re: Guide: Translating your UMC without WesCamp
And it is written in the original postCeltic_Minstrel wrote:Note that Wesnoth 1.13 can directly read po files
Maybe I will remove mentions of .mo files once Wesnoth 1.14 is out.James_The_Invisible wrote:On Wesnoth 1.13.7 and later, it should be enough to insert just the .po file.
The path is correct, I tried it myself with multiple add-ons. Do note that language should be replaced with abbreviation of a language.Celtic_Minstrel wrote:The location to place these files is slightly different though
My content: For Power series
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Re: Guide: Translating your UMC without WesCamp
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
Re: Guide: Translating your UMC without WesCamp
A po file was worked in translations/textdomain_name/, but translations/language/LC_MESSAGES/ needed a mo file.James_The_Invisible wrote: ↑January 14th, 2018, 7:25 pmThe path is correct, I tried it myself with multiple add-ons. Do note that language should be replaced with abbreviation of a language.Celtic_Minstrel wrote:The location to place these files is slightly different though
I tested on a Debian GNU/Linux.
- James_The_Invisible
- Posts: 537
- Joined: October 28th, 2012, 1:58 pm
- Location: Somewhere in the Northlands, fighting dark forces
- Contact:
Re: Guide: Translating your UMC without WesCamp
Thanks for the info, I will add it to the first post. (So that is what Celtic_Minstrel was talking about.)
My content: For Power series
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC