Approvals: 0/1
This is an old revision of the document!
Help with Translation
Batocera comes in a variety of local languages, and relies on the community to help with the translations. We need you for this!
How can I help?
Translate for a new language
- See what is the current status of your language. You can check on this page to see what's the % of strings that are currently translated for each supported language in the latest stable version of Batocera.
- Download the current translation file from this directory. It's an
emulationstation.po
text file with all the strings to be translated. - Compile your
emulationstation2.po
file intoemulationstation2.mo
. You can use the Poedit program on your desktop, or online with the Poeditor tool. - Connect to your batocera through SSH.
- Copy your
emulationstation2.mo
file to/usr/share/locale/{your_language_code}/LC_MESSAGES/
– for instance/usr/share/locale/pt_BR/LC_MESSAGES/emulationstation2.mo
for Brazilian Portuguese. - Open the command console (SSH terminal) and execute the command
batocera-save-overlay
to keep your changes upon reboot. - Restart your Batocera.
- Once you're happy with your translation, you can submit a PR via Github, or send your .po file back to the dev team on the #translations channel of our Discord server.
Translate missing strings for an already existing translation
- Open the
/usr/share/locale/{your_language_code}/LC_MESSAGES/emulationstation2.po
file for your chosen language with either POEdit or an ordinary text editor like Notepad++. - Make your translation edits and save the file, then run
batocera-save-overlay
from SSH/terminal to keep them after rebooting. - Get your
.po
file and put it into the #translations channel on our Discord server. - That's it.
Thank you for your help!
What if I wanted to edit an English string?
Generally editing already-existing English strings in the CPP files is discouraged, as it will remove the translation that was made for it (if it exists). However, there may be times when the English string is misspelled or just plain incorrect and needs to be amended, despite it already being translated.
The best way to go about this is to compile batocera-emulationstation, as that will automatically run the xgettext
and msgmerge
submodules used to generate the emulationstation2.pot
and subsequent PO files. You can then use a program like POEdit or just a plain text-editor to restore the translations (old translations are moved to being comments).
Understandably, this is a lot of work, especially with how many languages Batocera supports. So here's a mini-tutorial on how to automate the process (on Windows):
- Download and install the Find and Replace tool and Notepad++.
- Run
fnr.exe
from the ZIP file. - Set the Dir to the root of the
batocera-emulationstation
folder. - Add
*.po
to your File Mask. If you want to also use this tool to edit the string in the CPP itself, you can instead use*.po,*.cpp
. - Set Encoding to
utf-8
. Note that this isn't actually the correct encoding, but it's close enough. - Put in the original string you want to replace into the Find textbox.
- Click Find Only to test to see which strings it finds. This is important, especially if also editing CPP files, as it ensures you aren't accidentally overwriting code. If you want to be safe, enclose your find text in double-quotes (“”).
- Put in the new string you want to replace it with into the Replace textbox.
- Click Replace (the button… not the textbox label).
If you aren't sure of the setup, here's a professional grade pictograph detailing the settings that have been changed from default:
Since you've already cloned batocera-emulationstation, you can just push the PR to merge it. But what's this? You've noticed that after running git diff
(as every good developer does before merging a commit I'm sure), every file you've edited now has an additional, invisible character at the beginning that you're sure you didn't insert yourself? That's because Find and Replace is actually not so good with encoding text files so it inserts the Windows 16-bit signature into all the UTF-8 text files at the beginning. This is easy enough to fix.
- Open the afflicted text file with Notepad++.
- Click Encoding → UTF-8. You'll notice that it was originally on “UTF-8-BOM”.
- Save the file.
- Rinse and repeat for all afflicted text files.
This should get rid of the extra character at the beginning of the text files.
- help_with_translation.1633414334.txt.gz
- Last modified: 3 years ago
- by atari