From 4acede139745b650ee138701909e04cef9ba8be3 Mon Sep 17 00:00:00 2001 From: Jente Hidskes Date: Thu, 17 Aug 2017 19:33:39 +0200 Subject: [PATCH] Add support for translations Based on earlier work by @whot: https://github.com/whot/piper/commit/44d8265d4a973ec45962d75f79e98fab1925b6ff Fixes #12. --- circle.yml | 2 +- meson.build | 1 + po/LINGUAS | 1 + po/POTFILES | 33 +++++++++++++++++++++++++++++++++ po/README.md | 36 ++++++++++++++++++++++++++++++++++++ po/meson.build | 3 +++ 6 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 po/LINGUAS create mode 100644 po/POTFILES create mode 100644 po/README.md create mode 100644 po/meson.build diff --git a/circle.yml b/circle.yml index f33576f..bcce165 100644 --- a/circle.yml +++ b/circle.yml @@ -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 diff --git a/meson.build b/meson.build index de9cf84..9ed069c 100644 --- a/meson.build +++ b/meson.build @@ -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') diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 0000000..e0d25c8 --- /dev/null +++ b/po/LINGUAS @@ -0,0 +1 @@ +# Language list must be in alphabetical order diff --git a/po/POTFILES b/po/POTFILES new file mode 100644 index 0000000..b1344f2 --- /dev/null +++ b/po/POTFILES @@ -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 diff --git a/po/README.md b/po/README.md new file mode 100644 index 0000000..5ba20d3 --- /dev/null +++ b/po/README.md @@ -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. diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 0000000..058ff8f --- /dev/null +++ b/po/meson.build @@ -0,0 +1,3 @@ +i18n = import('i18n') + +i18n.gettext('piper', preset: 'glib')