Skip to content

Instantly share code, notes, and snippets.

@ckerr
Last active March 19, 2022 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ckerr/7528b92401d4aa2b65ae83fd0c07f1c4 to your computer and use it in GitHub Desktop.
Save ckerr/7528b92401d4aa2b65ae83fd0c07f1c4 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# This folds the Qt, GTK, utils, and libtransmission strings all into a single potfile
# for ease of finding similar or conflicting strings that can be unified.
#
# TODO: would it make sense to submit a single potfile to translators, then massage
# their translations to make per-client translation files? Even though there are
# superficial differences that prevent some unification (e.g. Qt accelerators "&Open"
# GTK accelerators "_Open") it might be *conceptually* similar to translators when they
# see the similar strings next to each other?
rm -f a.pot b.pot c.pot transmission_en.ts
xgettext --add-comments --from-code=utf-8 --language=C++ --sort-output --output=a.pot --keyword=_ --keyword=Q_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 gtk/*cc
xgettext --add-comments --from-code=utf-8 --language=C++ --sort-output --output=b.pot --keyword=_ --sort-output libtransmission/*cc daemon/*cc utils/*cc
lupdate -silent qt/ -ts transmission_en.ts
lconvert -input-file transmission_en.ts -output-file c.pot
echo 'creating transmission.pot'
msgcat --sort-output --output-file=transmission.pot a.pot b.pot c.pot
rm a.pot b.pot c.pot transmission_en.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment