chamesle

chamesle.org: the site of Chamesle, a small Linux distribution
git clone https://github.com/tortr-rs/chamesle
Log | Files | Refs | README

i18n.sh (2128B)


      1 #!/bin/sh
      2 # strings of our apps -> tools/pkg/chamesle-l10n/files/chamesle.pot, and into every language's .po
      3 #   tools/i18n.sh
      4 set -eu
      5 cd "$(dirname "$0")/.."
      6 P=tools/pkg/chamesle-l10n/files
      7 O="--from-code=UTF-8 --add-comments=TRANSLATORS --no-wrap --sort-by-file --package-name=Chamesle --msgid-bugs-address=https://github.com/tortr-rs/chamesle/issues"
      8 # the python apps, then the shell ones joined on
      9 xgettext $O -L Python --keyword=_ --keyword=N_ --keyword=ngettext:1,2 -o $P/chamesle.pot \
     10     tools/pkg/chamesle-store/files/usr/bin/chamesle-store \
     11     tools/pkg/chamesle-updater/files/usr/bin/chamesle-updater \
     12     tools/pkg/chamesle-drivers/files/usr/bin/chamesle-drivers \
     13     tools/pkg/chamesle-access/files/usr/bin/chamesle-access \
     14     overlay/usr/lib/jiggity/firstboot.py overlay/usr/lib/jiggity/ui.py overlay/usr/lib/jiggity/account.py
     15 xgettext $O -j -L Shell --keyword=_ -o $P/chamesle.pot \
     16     tools/pkg/chamesle-snapshots/files/usr/bin/chamesle-snapshot \
     17     tools/pkg/chamesle-wine/files/usr/bin/chamesle-exe \
     18     tools/pkg/chamesle-sddm/files/usr/lib/chamesle/sddm-setup
     19 # the menu entries' names and descriptions (not their keywords)
     20 D="tools/pkg/chamesle-store/files/usr/share/applications/org.chamesle.Store.desktop
     21 tools/pkg/chamesle-drivers/files/usr/share/applications/org.chamesle.Drivers.desktop
     22 tools/pkg/chamesle-wine/files/usr/share/applications/chamesle-exe.desktop
     23 tools/pkg/chamesle-access/files/usr/share/applications/org.chamesle.Access.desktop"
     24 xgettext $O -j -L Desktop --keyword= --keyword=Name --keyword=GenericName --keyword=Comment -o $P/chamesle.pot $D
     25 for f in $P/*.po; do
     26     [ -e "$f" ] || continue
     27     msgmerge -q -U --backup=none --no-wrap "$f" $P/chamesle.pot
     28 done
     29 # and the translations back into the menu entries, from the english lines alone
     30 T=$(mktemp -d); trap 'rm -rf "$T"' EXIT
     31 for f in $P/*.po; do l=$(basename "$f" .po); echo "$l" >> $T/LINGUAS; ln -s "$PWD/$f" $T/; done
     32 for d in $D; do
     33     grep -v '^[A-Za-z]\+\[' "$d" > $T/in.desktop
     34     msgfmt --desktop --keyword= --keyword=Name --keyword=GenericName --keyword=Comment --template=$T/in.desktop -d $T -o "$d"
     35 done