Expand description
Gettext tooling for apps that use patois. Call it from a build script
or an xtask.
gen_potandgen_pot_from_dirsextract strings from Rust source into a.pottemplate.extend_pot_from_source_dirsandprune_pot_from_source_dirskeep the strings of Swift and Kotlin source in the same template.compile_translationscompiles.pocatalogs to the.mofiles that an app embeds.gen_ios_stringsandgen_android_stringsgenerate translation assets for mobile apps.checkandlintfind translation mistakes in catalogs and source code.creditsreads the names of translators from the catalogs.poedits a.pofile and leaves the lines it doesn’t change as they were.
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-Translatorheaders of the.pofiles, 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
.pofiles in place.
Functions§
- compile_
translations - Compiles each
.pofile inpo_dirto<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("...")andnt("...", "...", n)calls in other languages to an existing.potfile. - gen_
android_ strings - Writes the translated strings of each
<lang>.poinpo_dirto<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>.poinpo_dirto<ios_dir>/<lang>.lproj/Localizable.strings. - gen_pot
- Regenerates
<po_dir>/<package_name>.potfrom every package with[package.metadata.patois] translatable = true, including dependencies. - gen_
pot_ from_ dirs - Regenerates
<po_dir>/<package_name>.potfrom the Rust files insource_dirs. - prune_
pot_ from_ source_ dirs - Removes the entries that
extend_pot_from_source_dirsadded whose strings are no longer in the sources, and returns those strings.