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.

75 lines
2.5 KiB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. ## ADD SUPPORT FOR NEW LANGUAGE
  2. **Requires**: [GNU GetText](https://www.gnu.org/software/gettext/) (If you want to build the MO files on your own)
  3. ###You have two options in order to add a new translation on youtube-dlg.
  4. 1. Translate the files and send them to me via email.
  5. 2. Fork youtube-dlg and push changes on your own.
  6. ####1st Way
  7. 1. Download the source code
  8. 1. Either download & extract the source from [here](https://github.com/MrS0m30n3/youtube-dl-gui/archive/master.zip)
  9. 2. Or run `git clone https://github.com/MrS0m30n3/youtube-dl-gui youtube-dl-gui-master`
  10. 2. Change directory into **youtube-dl-gui-master**
  11. 3. Copy **youtube_dl_gui/locale/en_US/LC_MESSAGES/youtube_dl_gui.po** -> **locale_build/**
  12. 4. Change directory into **locale_build**
  13. 5. Edit the PO file with your favorite text editor (See *EDIT* section)
  14. 6. Send me the translated PO file via email to: ytubedlg@gmail.com
  15. ####2nd Way
  16. 1. Fork youtube-dlg project (See [Fork A Repo](https://help.github.com/articles/fork-a-repo/))
  17. 2. Clone your repository `git clone https://github.com/<your-username>/youtube-dl-gui`
  18. 3. Change directory into **youtube-dl-gui**
  19. 4. Copy **youtube_dl_gui/locale/en_US/LC_MESSAGES/youtube_dl_gui.po** -> **locale_build/**
  20. 5. Change directory into **locale_build**
  21. 6. Edit the PO file with your favorite text editor (See *EDIT* section)
  22. 7. Build the binary translation file (MO) using the build scripts (See *BUILD* section)
  23. 8. Push changes:
  24. `git add -A; git commit -m "Your commit message here"; git push origin master`
  25. 9. Now you can open a new pull request
  26. ### EDIT
  27. PO file headers informations:
  28. https://www.gnu.org/software/gettext/manual/html_node/Header-Entry.html
  29. To translate the PO file just edit the **msgstr** fields
  30. **Example**
  31. ``` pot
  32. #: mainframe.py:78
  33. msgid "Download"
  34. msgstr "Add the translation here"
  35. ```
  36. ### BUILD
  37. 1. To build the MO file you need to run the corresponding build script for your OS
  38. **Windows**: build_locale.bat
  39. **Linux**: build_locale.sh
  40. **Usage**
  41. `build_locale.<sh-bat> <language code> <translated PO file>`
  42. **Example**
  43. `./build_locale.sh gr_GR gr.po`
  44. 2. Now you also need to add the corresponding language option under the options frame localization tab
  45. 1. Open optionsframe.py
  46. 2. Locate the LocalizationTab class
  47. 3. Find the LOCALE_NAMES attribute
  48. 4. Add your language to the LOCALE_NAMES
  49. **Example**
  50. ``` python
  51. LOCALE_NAMES = twodict([
  52. ('en_US', 'English'),
  53. + ('gr_GR', 'Greek')
  54. ])
  55. ```