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.

146 lines
7.2 KiB

9 years ago
7 years ago
9 years ago
7 years ago
9 years ago
7 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
7 years ago
7 years ago
7 years ago
  1. # Localization Guide - [Transifex](https://www.transifex.com/youtube-dl-gui/public/)
  2. ## 🔴 DISCLAIMER
  3. **By sending a translation you agree to publish your work under the [UNLICENSE](https://unlicense.org/) license!**
  4. ## Contents
  5. * [Translators](localization_howto.md#translators)
  6. * [Testers](localization_howto.md#testers)
  7. * [Devs](localization_howto.md#devs)
  8. * [FAQs](localization_howto.md#faqs)
  9. ## Translators
  10. ### Requirements
  11. * A modern browser
  12. * A Transifex account, [sign-up](https://www.transifex.com/signup/)
  13. ### Notes
  14. * If your language is currently not supported you can make a request for new language support.
  15. * When you request support for a new language, the language code should be in the format **en_US** and NOT just **en**.
  16. * Variables such as **{0}**, **{1}**, **{dir}**, **{0:.1f}**, etc should be copied exactly as they appear in the translation box.
  17. * Variables represent a word that will be replaced by real data (name, number, etc).
  18. * Variables can be moved around the string in order to make the most logical translation.
  19. * When new strings for translation are available you will get inbox notifications.
  20. * For help you can leave a comment with @username or send a direct message to one of the maintainers.
  21. * Maintainer usernames are: `MrS0m30n3`, `nodiscc`
  22. ### Gettings Started
  23. 1. [Sign-in](https://www.transifex.com/signin/) to Transifex
  24. 2. [Join a translation team](https://docs.transifex.com/getting-started/translators#joining-a-translation-team)
  25. 3. [Start translating using the web editor](https://docs.transifex.com/translation/translating-with-the-web-editor)
  26. ### Help
  27. * [Translators getting started](https://docs.transifex.com/getting-started/translators)
  28. * [Translating offline](https://docs.transifex.com/translation/offline)
  29. * [Using the glossary](https://docs.transifex.com/translation/using-the-glossary)
  30. * For help you can [leave a comment or open an issue](https://docs.transifex.com/translation/tools-in-the-editor#comments-and-issues)
  31. ## Testers
  32. ### Requirements
  33. * Check [project requirements](../README.md#requirements)
  34. * [Git](https://git-scm.com/downloads)
  35. * [Transifex CLI client](https://docs.transifex.com/client/installing-the-client)
  36. * Some kind of text editor to edit some code (notepad++, nano, etc are sufficient)
  37. * A Transifex account, [sign-up](https://www.transifex.com/signup/)
  38. ### Notes
  39. * The instructions below assume basic knowledge of the command line (OS independent).
  40. * The **language code** being used should be in the format `<ISO 639-1>_<ISO 3166-1 alpha-2>` (e.g. en_US).
  41. * You can locally edit the translation file (PO) by opening it using a simple editor and editing the **msgstr** fields.
  42. * You can find the translation file (PO) after downloading it under the
  43. `youtube_dl_gui/locale/<LANG_CODE>/LC_MESSAGES/` directory.
  44. * In order to get the translations from Transifex **your account needs permissions to access the project**.
  45. ### Getting Started
  46. 1. Open a terminal
  47. 2. Test that Git works: `git --version`
  48. 3. Test that Transifex CLI client works: `tx --version`
  49. 4. Clone upstream using Git: `git clone https://github.com/MrS0m30n3/youtube-dl-gui`
  50. 5. Change to project directory: `cd youtube-dl-gui`
  51. 6. Pull the translation you want to test from Transifex (**Auth needed**): `tx pull --force -l <LANGUAGE_CODE_HERE>`
  52. 7. Make the language appear under **Options>General** tab (only for new languages):
  53. 1. Open the **optionsframe.py** under the **youtube_dl_gui** directory
  54. 2. Search for the **LOCALE_NAMES** attribute
  55. 3. Add the new language to it (in our example `('el_GR', 'Greek'),`)
  56. 4. Don't forget to save your changes
  57. ```python
  58. LOCALE_NAMES = twodict([
  59. + ('el_GR', 'Greek'), # language_code, language_name
  60. ('ar_SA', 'Arabic'),
  61. ('cs_CZ', 'Czech'),
  62. ...
  63. ```
  64. 8. Build the binary translation files (MO): `python setup.py build_trans`
  65. 9. Test the translations by running youtube-dl-gui and selecting your language: `python -m youtube_dl_gui`
  66. 10. Make changes locally in your translation file (PO) and go back to step 8 to test them
  67. ### Help
  68. * [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
  69. * [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
  70. * [Command line basics Linux](https://lifehacker.com/5633909/who-needs-a-mouse-learn-to-use-the-command-line-for-almost-anything)
  71. ## Devs
  72. ### Requirements
  73. * See [Testers](localization_howto.md#testers) requirements
  74. ### Notes
  75. * Read [Testers](localization_howto.md#testers) notes first.
  76. * Binary translation files (MO) are ignored and you should not push them upstream.
  77. * Don't forget to update the [ChangeLog](../ChangeLog) after adding a new language.
  78. * You can gather all extra requirements below using **pip**.
  79. ### Getting Started
  80. #### Add a new language under Options>General tab
  81. 1. Open the **optionsframe.py** file
  82. 2. Search for the **LOCALE_NAMES** attribute
  83. 3. Add the new language to it and make sure to **sort alphabetically** based on the language name
  84. ```python
  85. LOCALE_NAMES = twodict([
  86. ('en_US', 'English'),
  87. ('fr_FR', 'French'),
  88. + ('el_GR', 'Greek'),
  89. ('it_IT', 'Italian'),
  90. ...
  91. ```
  92. #### Build the binary translation files (MO)
  93. 1. Just run the setup script: `python setup.py build_trans`
  94. #### Automatically check translations using Google translate (Requires: polib & doodle_translate)
  95. 1. Change directory to `devscripts`
  96. 2. Run the check script: `python check-translation.py <LANGUAGE_CODE_HERE>`
  97. #### Get translations from Transifex (Requires: Permissions to access project)
  98. * Pull everything: `tx pull -a`
  99. * Pull reviewed: `tx pull --mode reviewed -a`
  100. * Pull everything (force): `tx pull -a -f`
  101. * Pull specific language: `tx pull -l <LANGUAGE_CODE_HERE>`
  102. * Pull only completed translations (100%): `tx pull -a --minimum-perc=100`
  103. #### Update source strings (Only Maintainers, Requires: python-gettext)
  104. 1. Change directory to `devscripts`
  105. 2. Run the `update-locales.sh` script (also builds MO files)
  106. 3. Push changes to Transifex: `tx push --source --translations`
  107. #### Add support for new language locally (DEPRECATED, ONLY TESTING)
  108. 1. Change directory to `devscripts`
  109. 2. Run the new locale script: `python new-locale.py <LANGUAGE_CODE_HERE>`
  110. ### Help
  111. * [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
  112. * [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
  113. * [PO file headers](https://www.gnu.org/software/gettext/manual/html_node/Header-Entry.html)
  114. * [GNU gettext manual](https://www.gnu.org/software/gettext/manual/html_node/index.html#SEC_Contents)
  115. * Transifex [user roles](https://docs.transifex.com/teams/understanding-user-roles)
  116. * Transifex [CLI client introduction](https://docs.transifex.com/client/introduction)
  117. ## FAQs
  118. * **Translations unnecessarily having country codes?**:
  119. Some languages have dialects in different countries. For example, `de_AT` is used for Austria, and `pt_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.