mirror of
https://github.com/narrrl/proton-drive-linux.git
synced 2026-11-04 16:56:59 +01:00
feat(core,gui): gettext translations and language preference
The app, the tray and the search prompt route every user-visible string through GNU gettext in the `pdfs` text domain, with named placeholders and plural forms. po/ holds the template, update and build scripts, and catalogs for de, en_GB, es, fr, it, nl, pl and pt_BR. Preferences gains a Language row that overrides the system language from the next start (config `language`). Packages compile the catalogs into /usr/share/locale and the desktop files carry translated descriptions and keywords. docs/TRANSLATING.md describes the workflow.
This commit is contained in:
1 parent
66ab1f5b16
commit
d9064ef880
52 files changed
+45287
-1569
No files matched your search
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
# Regenerate po/pdfs.pot from the sources listed in po/POTFILES.in, then merge
|
||||
# the new template into every catalog in po/LINGUAS. Run from anywhere.
|
||||
set -euo pipefail
|
||||
|
||||
po_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "$po_dir/.."
|
||||
|
||||
version="$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2)"
|
||||
|
||||
xgettext \
|
||||
--language=Rust \
|
||||
--from-code=UTF-8 \
|
||||
--files-from=po/POTFILES.in \
|
||||
--output=po/pdfs.pot \
|
||||
--package-name=proton-drive-linux \
|
||||
--package-version="$version" \
|
||||
--msgid-bugs-address=https://github.com/narrrl/proton-drive-linux/issues \
|
||||
--add-comments=Translators: \
|
||||
--sort-by-file \
|
||||
--keyword= \
|
||||
--keyword=gettext \
|
||||
--keyword=gettext_f \
|
||||
--keyword=gettext_noop \
|
||||
--keyword=pgettext:1c,2 \
|
||||
--keyword=ngettext:1,2 \
|
||||
--keyword=ngettext_f:1,2
|
||||
|
||||
while read -r lang; do
|
||||
[ -n "$lang" ] || continue
|
||||
if [ -f "po/$lang.po" ]; then
|
||||
msgmerge --quiet --update --backup=none --previous "po/$lang.po" po/pdfs.pot
|
||||
else
|
||||
msginit --no-translator --locale="$lang.UTF-8" --input=po/pdfs.pot --output-file="po/$lang.po"
|
||||
fi
|
||||
done < po/LINGUAS
|
||||
Reference in new issue
Block a user