User:Victor Grousset - tuxayo/Translation

From Koha Wiki
Jump to navigation Jump to search

Technical stuff

Update .po files (sync them with the code)

To make new strings in the code available in the .po files.

misc/translator/translate update fr-FR

# OR
gulp po:update --lang fr-FR

See the string changes of a patch

cd misc/translator/po
../translate update fr-FR
git add .
# apply patches
../translate update fr-FR

# look at the strings changes
git diff | rg "\+msgid|\-msgid"  # only the essential
git diff  # if fuller context is needed but lots of noise
git diff | rg -v "\-\#|\+\#|^ $|^ #|^ msg" | less  # still noise but more context

# cleanup git state and remove the .pot (they are not versioned)
git restore --staged misc/translator ; git restore misc/translator
rm -f ../*.pot

Deploy the translation

# can be ran multiple times to update
misc/translator/translate install fr-FR

# OR
# deploy for the 1st time
koha-translate --install fr-FR --dev kohadev
# reinstall when already installed (not be confused with updating the .po files (sync them with the code))
koha-translate --update fr-FR --dev kohadev

Remove

koha-translate --remove fr-FR --dev kohadev

Translation process

Necessity to translate also in newer versions of Koha if working on older versions

This might be the most important info to spread among translators, because a lot of work is lost on each major version. Most people aren't using the latest version of Koha and most translators seem to be only translating their version.

Let's compare two branches:

If we switch repeatedly between the two pages we can see that for a lot of languages 19.11 is more translated. This advance will be lost as it's not copied to the future versions. So next cycle translators will have to translate part of the same strings and that will happen on each cycle. The only way to have a translation copied to the future versions of Koha is to do it for the newest version available in the translation platform. Because around a month before a new major release of Koha, the translation for the current release are copied to create the future version.

In other words, translations missing in the latest Koha version compared to the old major versions will also be missing in the next one. But when a translation is added to stable, it will "stay forever". So always also copy your translation work to the more recent versions of Koha

Info about the translation toolchain

JS files

__("") picks from -messages-js.po . See https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21156

And it doesn't work in JS in .tt files.

tt files

Use [% t('A translatable string') %] https://wiki.koha-community.org/wiki/Internationalization,_plural_forms,_context,_and_more_RFC

Legacy way for JS in .tt files

_("") picks from -staff-prog.po. And it doesn't work in .js files.