Skip to main content

Crate patois_build

Crate patois_build 

Source
Expand description

Gettext tooling for apps that use patois. Call it from a build script or an xtask.

Modules§

check
Checks that a translation kept the parts of its source that aren’t prose: the placeholders, the accelerator, the shortcut suffix, and all the plural forms.
credits
Translator credits from the Last-Translator headers of the .po files, so an app credits a new translator in the same commit that adds their language.
lint
Checks that catch translation mistakes nothing else reports.
po
Edits .po files in place.

Functions§

compile_translations
Compiles each .po file in po_dir to <locale_dir>/<lang>/LC_MESSAGES/<domain>.mo, where <domain> is the name of the crate.
extend_pot_from_source_dirs
Adds the strings of t("...") and nt("...", "...", n) calls in other languages to an existing .pot file.
gen_android_strings
Writes the translated strings of each <lang>.po in po_dir to <assets_dir>/translations/<lang>.json, as an object that maps each msgid to its translation.
gen_ios_strings
Writes the translated strings of each <lang>.po in po_dir to <ios_dir>/<lang>.lproj/Localizable.strings.
gen_pot
Regenerates <po_dir>/<package_name>.pot from every package with [package.metadata.patois] translatable = true, including dependencies.
gen_pot_from_dirs
Regenerates <po_dir>/<package_name>.pot from the Rust files in source_dirs.
prune_pot_from_source_dirs
Removes the entries that extend_pot_from_source_dirs added whose strings are no longer in the sources, and returns those strings.