-
Notifications
You must be signed in to change notification settings - Fork 28
Translations as a translator with git
This guide is in sections. Not all of them are needed, depending on the state. If instructions here are unclear please ask in our Discord server.
Steps:
- Preparing development environment
- (Optionally) Adding a Language
- Update translation keys
- Changing translation string
- Commit changes
- Start pull request
alternatively you can contribute translation using Github website directly
If you are unfamiliar with Github and git then these steps will help you prepare to submit a translation.
You'll need git
sed
xgettext
and msgmerge
as well as bash
shell
- Fork the repository this link will create a fork of the copy linked to your Github user.
- Clone your copy of the repository to your local machine
If the language you wish to add translations for does not yet exist then you will first need to create a folder to put it in. Firstly work out which 2-letter code is needed. These codes are available Here as ISO-639-1
For these examples I will use Welsh (cy
)
from here go into the project directory discover_overlay/locales
and create your language directory cy
and then LC_MESSAGES
, ending up with the empty directory discover_overlay/locales/cy/LC_MESSAGES
.
Now create an empty file default.po
inside this new directory
mkdir -p discover_overlay/locales/cy/LC_MESSAGES
touch discover_overlay/locales/cy/LC_MESSAGES/default.po
Grab a terminal and cd
to the directory of the project, if you are not already there.
Run ./remake_base_pot.sh
which will check for any new translatable strings and update all translations so they have any new keys
After updating keys, the default.po
of the language you wish to edit should have a bunch of key and value pairs listed through the text document.
The top of the file has some header data, after which you will see lines starting with msgid
followed by lines starting with msgstr
. Leave the msgid
as is and the msgstr
directly afterwards should be changed to the translated string for that word or phrase.
After the file is saved, add the changes to git with git add discover_overlay/locales/cy
and then push these back to your github fork with git push
At this point, your github project page should show an option to start a Pull Request
in which case go ahead and write a title for the request (along the lines of 'New translations for Welsh' or 'Fixes translations for Welsh') and submit it for review.