2.5 KiB
ADD SUPPORT FOR NEW LANGUAGE
Requires: GNU GetText (If you want to build the MO files on your own)
###You have two options in order to add a new translation on youtube-dlg.
- Translate the files and send them to me via email.
- Fork youtube-dlg and push changes on your own.
####1st Way
- Download the source code
- Either download & extract the source from here
- Or run
git clone https://github.com/MrS0m30n3/youtube-dl-gui youtube-dl-gui-master
- Change directory into youtube-dl-gui-master
- Copy youtube_dl_gui/locale/en_US/LC_MESSAGES/youtube_dl_gui.po -> locale_build/
- Change directory into locale_build
- Edit the PO file with your favorite text editor (See EDIT section)
- Send me the translated PO file via email to: ytubedlg@gmail.com
####2nd Way
- Fork youtube-dlg project (See Fork A Repo)
- Clone your repository
git clone https://github.com/<your-username>/youtube-dl-gui
- Change directory into youtube-dl-gui
- Copy youtube_dl_gui/locale/en_US/LC_MESSAGES/youtube_dl_gui.po -> locale_build/
- Change directory into locale_build
- Edit the PO file with your favorite text editor (See EDIT section)
- Build the binary translation file (MO) using the build scripts (See BUILD section)
- Push changes:
git add -A; git commit -m "Your commit message here"; git push origin master
- Now you can open a new pull request
EDIT
PO file headers informations: https://www.gnu.org/software/gettext/manual/html_node/Header-Entry.html
To translate the PO file just edit the msgstr fields
Example
#: mainframe.py:78
msgid "Download"
msgstr "Add the translation here"
BUILD
-
To build the MO file you need to run the corresponding build script for your OS
Windows: build_locale.bat
Linux: build_locale.sh
Usage
build_locale.<sh-bat> <language code> <translated PO file>
Example
./build_locale.sh gr_GR gr.po
-
Now you also need to add the corresponding language option under the options frame localization tab
-
Open optionsframe.py
-
Locate the LocalizationTab class
-
Find the LOCALE_NAMES attribute
-
Add your language to the LOCALE_NAMES
Example
LOCALE_NAMES = twodict([
('en_US', 'English'),
+ ('gr_GR', 'Greek')
])