Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
help_with_translation [2022/02/18 00:58] – You don't actually need to reboot to see the translations. atarihelp_with_translation [2023/02/09 02:41] (current) – cleanup/correction atari
Line 5: Line 5:
 ===== For translators ===== ===== For translators =====
  
-==== Translate for a new language ====+  - First check if someone has already started a translation on [[http://translations.batocera.org/|the translations page]]. Download the two ''*.pot'' files for your language you are going to add translations for. The two files are for EmulationStation-specific strings (ES file) and system-specific options (Options file). If starting a new language, download the ''*.pot'' files from the ''new language'' row in the table. 
 +  - Edit and then compile your translation files. You can use the [[https://poedit.net/|Poedit program]] on your desktop, or online with the [[https://localise.biz/free/poeditor|Poeditor tool]] to create the ''*.po'' and ''emulationstation2.mo'' files specific to your language.<WRAP center round important> 
 +If using a plain text editor to make your modifications instead, make sure it keeps the Unix end-of-line terminators. 
 +</WRAP> 
 +  - [[#test_the_translation|Test your translation]] to ensure no lines are cut-off in the UI, special characters appear as intended and most importantly that Batocera does not crash. 
 +  - Once you're happy with your translation, on the translation page click the region code of your language in the "Code" column and then upload the file to the appropriate "ES file" or "Options file" column on the right side. \\ {{:translation_steps.png|Screenshot showing the step order of clicks, from left to right, top to bottom.}}<WRAP center round tip> 
 +If it's a brand new language, please contact the dev team on the [[https://discord.gg/ndyUKA5|#translations-files channel of our Discord server]] to get your language added to the table. 
 +</WRAP>
  
-  - Download (right click on "Raw" and save) the current translation file (it's a PO text file with all the strings to be translated): +Thank you so much for your help!
-    * For EmulationStation-specific lines: https://github.com/batocera-linux/batocera-emulationstation/blob/master/locale/emulationstation2.pot +
-    * For Batocera-specific lines: https://github.com/batocera-linux/batocera.linux/blob/master/package/batocera/emulationstation/batocera-es-system/locales/batocera-es-system.pot +
-  - Download the current translation file [[https://github.com/batocera-linux/batocera-emulationstation/tree/master/locale/lang|from this directory]]. It's an ''emulationstation.po'' text file with all the strings to be translated. +
-  - Compile your ''emulationstation2.po'' file into ''emulationstation2.mo''. You can use the [[https://poedit.net/|Poedit program]] on your desktop, or online with the [[https://localise.biz/free/poeditor|Poeditor tool]] to create the ''emulationstation2.po'' and ''emulationstation2.mo'' files specific to your language. +
-  - [[#test_the_translation|Test your translation]]; ensure no lines are cut-off in the UI and that special characters appear as intended. +
-  - 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 [[https://discord.gg/ndyUKA5|#translations channel of our Discord server]]. Only the ''.po'' files need to be uploaded, not the ''.mo'' files.+
  
-==== Translate missing strings for an already existing translation ====+<WRAP center round tip> 
 +    * To see a list of the list of missing strings to be translated with their respective line numbers, click on the number in the **ES missing** and **Options missing** columns respectively. 
 +    * If you see a "timer" icon after the file, it means that someone just uploaded a new translation file that hasn't been merged into GitHub yet. 
 +</WRAP>
  
-  - See what is the current status of your language. You can [[https://mirrors.o2switch.fr/batocera/x86_64/beta/last/|check on this page]] to see the percentage of strings that are currently translated for each supported language in the latest stable version of Batocera. +==== Test your translation ====
-  - Download (right click on "Raw" and save) the current translation file for your language: +
-    * For EmulationStation-specific lines: https://github.com/batocera-linux/batocera-emulationstation/tree/master/locale/lang +
-    * For Batocera-specific lines: https://github.com/batocera-linux/batocera.linux/blob/master/package/batocera/emulationstation/batocera-es-system/locales +
-  - Open the ''emulationstation2.po'' or ''batocera-es-system.po'' file for your chosen language with either POEdit or an ordinary text editor like Notepad++. +
-  - Make your translation edits (your translation should be in the ''msgstr ""'' part in the double-quotes ("")) and save the file. +
-  - [[#test_the_translation|Test your translation]]; ensure no lines are cut-off in the UI and that special characters appear as intended. +
-  - Get your ''.po'' file and put it into the #translations channel on our Discord server, mentioning which language it is for. Only the ''.po'' files need to be uploaded, not the ''.mo'' files. +
-  - That's it. +
- +
-Thank you for your help! +
- +
-===== Test your translation =====+
  
   - Merge the ''emulationstation2.po'' and ''batocera-es-system.po'' files in your preferred editor and export the ''emulationstation2.mo'' file from it.   - Merge the ''emulationstation2.po'' and ''batocera-es-system.po'' files in your preferred editor and export the ''emulationstation2.mo'' file from it.
   - Connect to Batocera via [[:winscp|WinSCP]] (or [[:access_the_batocera_via_ssh|via SSH]]).   - Connect to Batocera via [[:winscp|WinSCP]] (or [[:access_the_batocera_via_ssh|via 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.   - 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.
-  - On a keyboard connected to the Batocera machine, press ''[Alt]'' + ''[F4]'' (or run ''%%batocera-es-swissknife --restart%%'' if in SSH). +  - On a keyboard connected to the Batocera machine, press ''[Alt]'' + ''[F4]'' (or run ''%%batocera-es-swissknife --restart%%'' if in SSH) to refresh the language strings in ES
-  - You will see your translated strings.+  - Now explore ES to view all the strings you've translated!
  
 To keep your changes persistent between reboots, connect via SSH if you haven't already and run ''batocera-save-overlay'' to save the overlay. To keep your changes persistent between reboots, connect via SSH if you haven't already and run ''batocera-save-overlay'' to save the overlay.
  
-===== Manually add in a line to be translated =====+===== For developers ===== 
 + 
 +==== Manually add in a line to be translated ====
  
 If there is a line in EmulationStation that does not have a string entry in the PO file, then it can be manually added in with the fake_gettext library: If there is a line in EmulationStation that does not have a string entry in the PO file, then it can be manually added in with the fake_gettext library:
Line 55: Line 49:
 Place this into the top of the function which contains the untranslated string and upon next compilation it will be added to all the relevant PO files. Place this into the top of the function which contains the untranslated string and upon next compilation it will be added to all the relevant PO files.
  
-===== Add a comment in the code for translators =====+==== Add a comment in the code for translators ====
  
 If you are coding something new in Batocera and think that the string to be translated might be a bit ambiguous for translators (remember, they will only see the string in isolation, which might not make sense outside of its context), you can add a comment just for translators to see when they get to that string. In EmulationStation or Batocera's es_features, add the following comment right before the code in which the string appears: If you are coding something new in Batocera and think that the string to be translated might be a bit ambiguous for translators (remember, they will only see the string in isolation, which might not make sense outside of its context), you can add a comment just for translators to see when they get to that string. In EmulationStation or Batocera's es_features, add the following comment right before the code in which the string appears:
Line 67: Line 61:
 {{:translation_string_example.png|An example of a translator comment in the code.}} {{:translation_string_example.png|An example of a translator comment in the code.}}
  
-===== What if I wanted to edit an English string? =====+==== Blacklisted words ==== 
 + 
 +What if you want to add in a string that's explicitly not meant to be translated, such as a proper noun, technical code string or the model name of a retro system? 
 + 
 +Most of these kinds of strings should be automatically picked up and removed by the ''createEsTranslations'' function in [[https://github.com/batocera-linux/batocera.linux/blob/master/package/batocera/emulationstation/batocera-es-system/batocera-es-system.py]], however there might come a case where a word fails to fall into one of its filters. 
 + 
 +Such words can be manually appended to https://github.com/batocera-linux/batocera.linux/blob/master/package/batocera/emulationstation/batocera-es-system/locales/blacklisted-words.txt in the source code. Just add the word on a new line, simple as that. 
 + 
 +==== 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. 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.
  • help_with_translation.1645142304.txt.gz
  • Last modified: 2 years ago
  • by atari