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.

73 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
  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. **Example**
  41. Usage: `build_locale.sh <language code> <translated PO file>`
  42. `./build_locale.sh gr_GR gr.po`
  43. 2. Now you also need to add the corresponding language option under the options frame localization tab
  44. 1. Open optionsframe.py
  45. 2. Locate the LocalizationTab class
  46. 3. Find the LOCALE_NAMES attribute
  47. 4. Add your language to the LOCALE_NAMES
  48. **Example**
  49. ``` python
  50. LOCALE_NAMES = twodict([
  51. ('en_US', 'English'),
  52. + ('gr_GR', 'Greek')
  53. ])
  54. ```