André pushed to branch master at gajim / gajim
Commits:
-
36c8287f
by André Apitzsch at 2020-06-24T19:59:08+02:00
1 changed file:
Changes:
| 1 |
-#!/bin/sh
|
|
| 2 |
- |
|
| 3 |
-PYFILES=$(find -L ./ -type f -name "*.py")
|
|
| 4 |
-GLADEFILES=$(find -L ./ -type f -name "*.ui")
|
|
| 5 |
- |
|
| 6 |
- |
|
| 7 |
-check_args()
|
|
| 8 |
-{
|
|
| 9 |
- if [ $# -ne 2 ]; then
|
|
| 10 |
- echo "Missing lang argument" >&2
|
|
| 11 |
- exit 4
|
|
| 12 |
- fi
|
|
| 13 |
-}
|
|
| 14 |
- |
|
| 15 |
-init_ln()
|
|
| 16 |
-{
|
|
| 17 |
- if [ ! -L "community_plugins" ]; then
|
|
| 18 |
- echo "community_plugins should be a symbolic link to gajim-plugins repository, else they won't be in po files"
|
|
| 19 |
- fi
|
|
| 20 |
-}
|
|
| 21 |
- |
|
| 22 |
-make_pot()
|
|
| 23 |
-{
|
|
| 24 |
- # Generate .ui.h
|
|
| 25 |
- find -L ./ -type f -name "*.ui" -exec intltool-extract --type="gettext/glade" {} \;
|
|
| 26 |
- GLADEHFILES=$(find -L ./ -type f -name "*.ui.h")
|
|
| 27 |
- xgettext -k_ -kN_ -o plugins_translations.pot $PYFILES $GLADEHFILES --from-code=utf-8
|
|
| 28 |
- rm $GLADEHFILES
|
|
| 29 |
-}
|
|
| 30 |
- |
|
| 31 |
-make_po()
|
|
| 32 |
-{
|
|
| 33 |
- if [ -f $1.po ]; then
|
|
| 34 |
- echo "Updating '$1' language";
|
|
| 35 |
- msgmerge -U $1.po plugins_translations.pot;
|
|
| 36 |
- else
|
|
| 37 |
- msginit -l $1.UTF-8 -o $1.po;
|
|
| 38 |
- fi
|
|
| 39 |
-}
|
|
| 40 |
- |
|
| 41 |
-make_mo()
|
|
| 42 |
-{
|
|
| 43 |
- if [ ! -f $1.po ]; then
|
|
| 44 |
- echo "$1.po doesn't exist. Use plugins_translation make_po $1 to create it.";
|
|
| 45 |
- exit 3
|
|
| 46 |
- fi
|
|
| 47 |
- mkdir -p locale/$1/LC_MESSAGES
|
|
| 48 |
- msgfmt -o $1.mo $1.po
|
|
| 49 |
-}
|
|
| 50 |
- |
|
| 51 |
-install_mo()
|
|
| 52 |
-{
|
|
| 53 |
- if [ -L community_plugins ]; then
|
|
| 54 |
- cp $1.mo community_plugins/plugins_translations/
|
|
| 55 |
- fi
|
|
| 56 |
- mkdir -p ~/.local/share/gajim/plugins/locale/$1/LC_MESSAGES/
|
|
| 57 |
- cp $1.mo ~/.local/share/gajim/plugins/locale/$1/LC_MESSAGES/gajim_plugins.mo
|
|
| 58 |
-}
|
|
| 59 |
- |
|
| 60 |
- |
|
| 61 |
-case "$1" in
|
|
| 62 |
- make_po)
|
|
| 63 |
- check_args $@
|
|
| 64 |
- init_ln
|
|
| 65 |
- make_pot
|
|
| 66 |
- make_po $2
|
|
| 67 |
- ;;
|
|
| 68 |
- make_mo)
|
|
| 69 |
- check_args $@
|
|
| 70 |
- make_mo $2
|
|
| 71 |
- ;;
|
|
| 72 |
- install_mo)
|
|
| 73 |
- install_mo $2
|
|
| 74 |
- ;;
|
|
| 75 |
- all)
|
|
| 76 |
- check_args $@
|
|
| 77 |
- init_ln
|
|
| 78 |
- make_pot
|
|
| 79 |
- make_po $2
|
|
| 80 |
- make_mo $2
|
|
| 81 |
- install_mo $2
|
|
| 82 |
- ;;
|
|
| 83 |
- *)
|
|
| 84 |
- echo "Usage: plugins_translation {all|make_po|make_mo|install_mo}" >&2
|
|
| 85 |
- echo "example: plugins_translation make_po fr_FR"
|
|
| 86 |
- exit 2
|
|
| 87 |
- ;;
|
|
| 88 |
-esac
|