There is a way to test a new translation for an application without having to re-compile an app after adding the new language to its Makefile etc.
For example, the current QuickLaunch release (v1.3.3) doesn’t yet support Turkish, though it’s been translated meanwhile (thanks Emir Sarı!). To test the translation we:
- Export the
tr.catkeys
(Turkish) of QuickLauch from Polyglot - Open a Terminal at the download location.
- Convert the catkeys to a catalog file with:
linkcatkeys -o tr.catalog -s "application/x-vnd.humdinger-quicklaunch" -l tr tr.catkeys
You find the app signature in the first line of the tr.cakeys. - Create a folder for the catalog named with the vendor part of the signature:
mkdir -p ~/config/non-packaged/data/locale/catalogs/x-vnd.humdinger-quicklaunch
- Move the catalog there:
mv tr.catalog ~/config/non-packaged/data/locale/catalogs/x-vnd.humdinger-quicklaunch
Now, if you’ve set “Turkish” in the Locale prefs, QuickLaunch will show the translated GUI strings.
Who is going to create a short bash script for this and post it in the comments?
Here’s a little bash-script that does what’s described above. Save as catkeystest.sh
, make executable with chmod +x catkeystest.sh
and put it in ~/config/non-packaged/bin/
.
#!/bin/sh
# catkeystest.sh
#
# A script to test new catkeys of an installed application.
# It converts the 'xx.catkeys' to a 'xx.catalog' file and
# puts it in a 'magic' folder where it is picked up when
# the app is launched.
if [ $# -eq 0 ] ; then
echo "Usage: catkeystest.sh CATKEYS"
exit
fi
if [ ! -e "${1}" ] ; then
echo "${1} not found!"
exit
fi
appSig=$(head -1 "${1}" | awk '{ print $3; }' | cut -f2 -d"/")
catLang=$(basename "${1}" .catkeys)
localeFolder=$(finddir B_USER_NONPACKAGED_DATA_DIRECTORY)/locale/catalogs
mkdir -p $localeFolder/$appSig
linkcatkeys -o $localeFolder/$appSig/$catLang.catalog -s "application/$appSig" -l $catLang "${1}"
if [ $? -ne 0 ] ; then
echo "Operation failed."
else
echo "Catalog created: $localeFolder/$appSig/$catLang.catalog"
fi