Add support for translations

Based on earlier work by @whot:

44d8265d4a

Fixes #12.
This commit is contained in:
Jente Hidskes
2017-08-17 19:33:39 +02:00
committed by Peter Hutterer
parent 33b4001a12
commit 4acede1397
6 changed files with 75 additions and 1 deletions

View File

@@ -14,7 +14,7 @@ jobs:
# now install and checks the resulting file (just in case)
- run:
command: |
dnf install -y meson python3-devel pygobject3-devel
dnf install -y meson gettext python3-devel pygobject3-devel
- run:
command: |
meson build

View File

@@ -18,6 +18,7 @@ pkgdatadir = join_paths(datadir, meson.project_name())
bindir = join_paths(prefix, get_option('bindir'))
subdir('data')
subdir('po')
# Find the directory to install our Python code
python = import('python3')

1
po/LINGUAS Normal file
View File

@@ -0,0 +1 @@
# Language list must be in alphabetical order

33
po/POTFILES Normal file
View File

@@ -0,0 +1,33 @@
piper/__init__.py
piper/application.py
piper/buttondialog.py
piper/buttonspage.py
piper/devicerow.py
piper/errorperspective.py
piper/gi_composites.py
piper/leddialog.py
piper/ledspage.py
piper/mousemap.py
piper/mouseperspective.py
piper/optionbutton.py
piper/profilerow.py
piper/ratbagd.py
piper/resolutionrow.py
piper/resolutionspage.py
piper/welcomeperspective.py
piper/window.py
data/ui/AboutDialog.ui.in
data/ui/ButtonDialog.ui
data/ui/ButtonRow.ui
data/ui/DeviceRow.ui
data/ui/ErrorPerspective.ui
data/ui/LedDialog.ui
data/ui/Menus.ui
data/ui/MousePerspective.ui
data/ui/OptionButton.ui
data/ui/ProfileRow.ui
data/ui/ResolutionRow.ui
data/ui/ResolutionsPage.ui
data/ui/WelcomePerspective.ui
data/ui/Window.ui

36
po/README.md Normal file
View File

@@ -0,0 +1,36 @@
i18n
====
This directory contains the translations of Piper.
For errors in translations, please [file an
issue](https://github.com/libratbag/piper/issues/new).
New or updated translations are always welcome. To start a new translation, run:
$ meson translation-build
$ ninja -C translation-build piper-pot
# Now you can optionally remove the build directory
$ rm -rf translation-build
$ cp po/piper.pot po/$lang.po
where `$lang` is the language code of your target language, e.g. `nl` for Dutch
or `en_GB` for British English. Edit the
[LINGUAS](https://github.com/libratbag/piper/blob/master/po/LINGUAS) file and
add your language code, keeping the list sorted alphabetically. Finally, open
the `.po` file you just created and translate all the strings. Don't forget to
fill in the information in the header!
To update an existing translation, run:
$ meson translation-build
$ ninja -C translation-build piper-update-po
# Now you can optionally remove the build directory
$ rm -rf translation-build
and update the `po/$lang.po` file of your target language.
When you are done translating, file a pull request on
[GitHub](https://github.com/libratbag/piper) or, if you don't know how to, [open
an issue](https://github.com/libratbag/piper/issues/new) and attach the `.po`
file there.

3
po/meson.build Normal file
View File

@@ -0,0 +1,3 @@
i18n = import('i18n')
i18n.gettext('piper', preset: 'glib')