This version is outdated by a newer approved version.DiffThis version (2021/10/05 08:12) is a draft.
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!

  1. 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.
  2. Download the current translation file from this directory. It's an emulationstation.po text file with all the strings to be translated.
  3. Compile your emulationstation2.po file into emulationstation2.mo. You can use the Poedit program on your desktop, or online with the Poeditor tool.
  4. Connect to your batocera through SSH.
  5. 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.
  6. Open the command console (SSH terminal) and execute the command batocera-save-overlay to keep your changes upon reboot.
  7. Restart your Batocera.
  8. 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.
  1. 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++.
  2. Make your translation edits and save the file, then run batocera-save-overlay from SSH/terminal to keep them after rebooting.
  3. Get your .po file and put it into the #translations channel on our Discord server.
  4. That's it.

Thank you for your help!

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):

  1. Download and install the Find and Replace tool and Notepad++.
  2. Run fnr.exe from the ZIP file.
  3. Set the Dir to the root of the batocera-emulationstation folder.
  4. 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.
  5. Set Encoding to utf-8. Note that this isn't actually the correct encoding, but it's close enough.
  6. Put in the original string you want to replace into the Find textbox.
  7. 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 (“”).
  8. Put in the new string you want to replace it with into the Replace textbox.
  9. 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.

  1. Open the afflicted text file with Notepad++.
  2. Click EncodingUTF-8. You'll notice that it was originally on “UTF-8-BOM”.
  3. Save the file.
  4. 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