FOLIO front-end code uses translation keys to fetch actual text in English or any other language.
This allows to change the translations after a module has been installed. The most common use case is to backport the latest translations into a FOLIO installation.
A FOLIO release like Honeysuckle, Iris, etc. ships with the translations that come with each front-end module. Each front-end module has a different release date (Honeysuckle example). This is the time when translations are taken from module's GitHub translations directory and is different for each front-end module. A new front-end module release is needed to get more recent translation included into a FOLIO release.
However, the sysOp of a FOLIO installation may manually update the translations of their installation by exchanging the files in the /translations/
directory from where the static files are shipped.
One option is to take the latest translations from https://folio-testing.dev.folio.org/ .
Do to it manually use the browser developer tools to find out the current number folio-testing uses, for example https://folio-testing.dev.folio.org/translations/de-1605513539114.json
. If you own installation has de-1601343197440.json
merge them: jq -s '.[0] * .[1]'
de-1601343197440.json de-1605513539114.json > de-1601343197440.json.new
Then use the joined file: mv de-1601343197440.json.new de-1601343197440.json
To do it automatically use this script:
#!/bin/sh # Before running this script change into the ./translations directory where the web server (nginx, ...) # ships the /translations/*.json files from, for example # cd /usr/folio/folio-testing-platform/output/translations set -e for FILE in ./*-*.json ; do if [ ! -e "$FILE" ] ; then continue fi LANG=$(echo "$FILE" | sed -n -E '/^.\/([^-]+)-[0-9]+\.json$/{s//\1/p;q}') if [ -z $LANG ] ; then continue fi URL="https://raw.githubusercontent.com/gbv/folio-translations/main/platform-complete/$LANG.json" if wget "$URL" -O $LANG.json; then echo "$URL" else echo "failure, skipping $URL" continue fi jq -c -s '.[0] * .[1]' $FILE $LANG.json > $LANG.json.new mv $LANG.json.new $FILE rm $LANG.json done |
To remove new translation keys replace'.[0] * .[1]'
by'.[0] as $old | .[0] * .[1] | with_entries( select( .key as $key | $old | has( $key ) ) )'
but this may remove a key that the old code uses and was forgotten to get added to the old language file.
The backport method described above is a hack.
The clean way to use more recent translations is to replace them during the front-end build process.
After running yarn install
but before running yarn build
copy the new translations into the node_modules/@folio/${application}/translations/ui-${application}/${locale}.json
files.
We don't know of anyone that uses this method, no script is available for this yet.