-
Notifications
You must be signed in to change notification settings - Fork 216
Guide to translating Syncplay into another language
The first thing you have to do is decide whether you are going to use the GitHub system to make the translations or if you want to just email us your translation:
- GitHub approach: It's easiest for us if people have a GitHub account, as they can then fork Syncplay into their own repository, change the files, then make a pull request on the official repository so that we can easily review the changes and accept them into the Syncplay code.
-
Email approach: Alternatively, you can just download the https://raw.githubusercontent.com/Syncplay/syncplay/master/syncplay/messages_en.py file and change all the text in quotation marks to English and email the result to
[email protected]
with confirmation of what name you wanted credited and that you are happy for us to integrate it into our code under our Apache 2.0 license.
This example translation is to translate Syncplay into Brazilian Portuguese.
Step 1. Create your new message-specific file
Create syncplay/messages_pt_BR.py
based on syncplay/messages_en.py. The pt_BR
is based on the language tag for Brazil listed at https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/a9eac961-e77d-41a6-90a5-ce1a8b0cdb9c?redirectedfrom=MSDN - Written as pt_BR rather than pt-BR to align with Syncplay naming conventions.
Some essential changes are needed at the start of the file following using a standardised format:
- On line 3, change
"""English dictionary"""
to"""Brazilian Portuguese dictionary"""
using the English language name for the language. - On line 7, change
en = {
topt_BR = {
to match the language tag from the filename. - On line 8, change
"LANGUAGE": "English"
to"LANGUAGE: "Português do Brasil"
, to use the local name for the language. - On line 9, change
"LANGUAGE-TAG: "en"
to"LANGUAGE-TAG": "pt_BR"
to reflect the language tag in line 7. - On line 12, change
""installer-language-file": "English.nlf",
toPortugueseBR.nlf
to use the relevant .nlf file at https://github.com/kichik/nsis/tree/master/Contrib/Language%20files
For the rest of the translations you generally just have to translate them into the target language.
A few things to bear in mind for these message translations:
- Throughout, messages are in the format of
"message-name": "message-text"
. Translate the message text, but not the message name. Do not translate any of the comments which come after a # symbol. - In some cases there are comments which explain the order in which the
{}
messages will be replaced with variables. You either have to follow this order in how you word your message, or use {0} {1} {2} etc to place the variables in the order you desire. For example if the variables are person ("Bob") and food ("Pizza") then"{} likes {}"
and"{0} likes {1}"
would both display as"Bob likes Pizza"
. On the other and, the message"{1} is liked by {0}"
would be displayed as"Pizza is liked by Bob"
. - There is limited space for the messages in the Windows installer (messages starting with
"installer-"
), so try to use shorter translations where possible. - Really long names for the option settings title will make the settings window really long, so try to keep "basics-label", "readiness-label", "sync-label", "messages-label" and "misc-label" to 12 characters or less if possible.
If you are emailing in your submission, you can skip Steps 2 and 3 and go straight to Part 3.
Step 2. Update messages.py to include the language.
Using the example of Brazilian Portuguese from Step 1, these are the changes which need to be made to the messages.py
file if you wish to make a GitHub Pull Request:
- Add
from . import messages_pt_BR
as its own line at the top of the file. The imports should be listed alphabetically based on their name in their own language (which is why Turkish is before Russian). - Add
"pt_BR": messages_pt_BR.pt_BR,
as its own line as part of themessages = {
part of the file. Use the same ordering as the imports.
Step 3. Add references to the language in the documentation.
Update the syncplay.1 documentation file entry for language language
(around line 100) to include the new language in the list (using the same ordering as for the imports), e.g. Language of Syncplay messages. Valid values are de/en/es/eo/fr/it/pt_PT/pt_BR/tr/ru/zh_CN.
Follow the GitHub or email based submission approach you chose in Part 1.