You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
7.2 KiB
7.2 KiB
Localization Guide - Transifex
🔴 DISCLAIMER
By sending a translation you agree to publish your work under the UNLICENSE license!
Contents
Translators
Requirements
- A modern browser
- A Transifex account, sign-up
Notes
- If your language is currently not supported you can make a request for new language support.
- When you request support for a new language, the language code should be in the format en_US and NOT just en.
- Variables such as {0}, {1}, {dir}, {0:.1f}, etc should be copied exactly as they appear in the translation box.
- Variables represent a word that will be replaced by real data (name, number, etc).
- Variables can be moved around the string in order to make the most logical translation.
- When new strings for translation are available you will get inbox notifications.
- For help you can leave a comment with @username or send a direct message to one of the maintainers.
- Maintainer usernames are:
MrS0m30n3
,nodiscc
Gettings Started
Help
- Translators getting started
- Translating offline
- Using the glossary
- For help you can leave a comment or open an issue
Testers
Requirements
- Check project requirements
- Git
- Transifex CLI client
- Some kind of text editor to edit some code (notepad++, nano, etc are sufficient)
- A Transifex account, sign-up
Notes
- The instructions below assume basic knowledge of the command line (OS independent).
- The language code being used should be in the format
<ISO 639-1>_<ISO 3166-1 alpha-2>
(e.g. en_US). - You can locally edit the translation file (PO) by opening it using a simple editor and editing the msgstr fields.
- You can find the translation file (PO) after downloading it under the
youtube_dl_gui/locale/<LANG_CODE>/LC_MESSAGES/
directory. - In order to get the translations from Transifex your account needs permissions to access the project.
Getting Started
- Open a terminal
- Test that Git works:
git --version
- Test that Transifex CLI client works:
tx --version
- Clone upstream using Git:
git clone https://github.com/MrS0m30n3/youtube-dl-gui
- Change to project directory:
cd youtube-dl-gui
- Pull the translation you want to test from Transifex (Auth needed):
tx pull --force -l <LANGUAGE_CODE_HERE>
- Make the language appear under Options>General tab (only for new languages):
- Open the optionsframe.py under the youtube_dl_gui directory
- Search for the LOCALE_NAMES attribute
- Add the new language to it (in our example
('el_GR', 'Greek'),
) - Don't forget to save your changes
LOCALE_NAMES = twodict([
+ ('el_GR', 'Greek'), # language_code, language_name
('ar_SA', 'Arabic'),
('cs_CZ', 'Czech'),
...
- Build the binary translation files (MO):
python setup.py build_trans
- Test the translations by running youtube-dl-gui and selecting your language:
python -m youtube_dl_gui
- Make changes locally in your translation file (PO) and go back to step 8 to test them
Help
Devs
Requirements
- See Testers requirements
Notes
- Read Testers notes first.
- Binary translation files (MO) are ignored and you should not push them upstream.
- Don't forget to update the ChangeLog after adding a new language.
- You can gather all extra requirements below using pip.
Getting Started
Add a new language under Options>General tab
- Open the optionsframe.py file
- Search for the LOCALE_NAMES attribute
- Add the new language to it and make sure to sort alphabetically based on the language name
LOCALE_NAMES = twodict([
('en_US', 'English'),
('fr_FR', 'French'),
+ ('el_GR', 'Greek'),
('it_IT', 'Italian'),
...
Build the binary translation files (MO)
- Just run the setup script:
python setup.py build_trans
Automatically check translations using Google translate (Requires: polib & doodle_translate)
- Change directory to
devscripts
- Run the check script:
python check-translation.py <LANGUAGE_CODE_HERE>
Get translations from Transifex (Requires: Permissions to access project)
- Pull everything:
tx pull -a
- Pull reviewed:
tx pull --mode reviewed -a
- Pull everything (force):
tx pull -a -f
- Pull specific language:
tx pull -l <LANGUAGE_CODE_HERE>
- Pull only completed translations (100%):
tx pull -a --minimum-perc=100
Update source strings (Only Maintainers, Requires: python-gettext)
- Change directory to
devscripts
- Run the
update-locales.sh
script (also builds MO files) - Push changes to Transifex:
tx push --source --translations
Add support for new language locally (DEPRECATED, ONLY TESTING)
- Change directory to
devscripts
- Run the new locale script:
python new-locale.py <LANGUAGE_CODE_HERE>
Help
- ISO 639-1
- ISO 3166-1 alpha-2
- PO file headers
- GNU gettext manual
- Transifex user roles
- Transifex CLI client introduction
FAQs
- Translations unnecessarily having country codes?:
Some languages have dialects in different countries. For example,
de_AT
is used for Austria, andpt_BR
for Brazil. The country code serves to distinguish the dialects. Also, using a single format (ll_CC) instead of multiple for the locale name simplifies some implementation specific things.