Guidelines and HOWTOs/Internationalization: Difference between revisions
→Useful tools: modernize due to Qt5 changes |
m Typo |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
== Useful Tools == | |||
== Useful | |||
; Lokalize | ; Lokalize | ||
: [http://userbase.kde.org/Lokalize Lokalize] is a computer-aided translation system that focuses on productivity and quality assurance. It has components usual for CAT tools: translation memory, glossary, and also a unique translation merging (synchronization) capability. It is targeted for software translation and also integrates external conversion tools for freelance office document translation. | : [http://userbase.kde.org/Lokalize Lokalize] is a computer-aided translation system that focuses on productivity and quality assurance. It has components usual for CAT tools: translation memory, glossary, and also a unique translation merging (synchronization) capability. It is targeted for software translation and also integrates external conversion tools for freelance office document translation. | ||
Line 22: | Line 20: | ||
: This helper language serves as a debugging aid for people finding untranslated strings in applications. If you start your application with the "x-test" locale, all translated strings will appear with trailing and leading xx's. First you have to check out these "translations" from l10n-kf5/x-test and install them. | : This helper language serves as a debugging aid for people finding untranslated strings in applications. If you start your application with the "x-test" locale, all translated strings will appear with trailing and leading xx's. First you have to check out these "translations" from l10n-kf5/x-test and install them. | ||
== Test Localization in your Application == | |||
This section handles how you can check the localization of your application. In order to demonstrate how to test localization, we assume that your built "dolphin" by using kdesrc-build in <code>~/kde/build/dolphin/</code>. | |||
After you've built l10n-kf5/x-test and installed it, run your application using the "x-test" locale. This can be done by launching it from the command line like this: | |||
<pre> | <pre> | ||
> LANG=x-test | > LANG=x-test dolphin | ||
</pre> | </pre> | ||
This will start Dolphin using the "x-test" locale no matter what your current language setting is. Look for strings that do not have the xx's. If xx's are missing from a string, it could be due to missing i18n calls or even missing or incorrectly generated .pot files. Consult the i18n tutorials for further information. | |||
When checking for untranslated strings, be sure to check all the WhatsThis help and tooltips. | |||
=== Manual Setup === | === Test via Manual Setup === | ||
# Check that in the main <code>CMakeLists.txt</code> file of your project the following macro is contained: <code>ki18n_install(po)</code> | # Check that in the main <code>CMakeLists.txt</code> file of your project the following macro is contained: <code>ki18n_install(po)</code> | ||
# Go to your build directory and obtain the translation test files for the x-test language (see above) and put it into a subfolder named <code>po</code> | # Go to your build directory and obtain the translation test files for the x-test language (see above) and put it into a subfolder named <code>po</code> | ||
Line 56: | Line 54: | ||
Now, every visible string shall start and end with an "x". If any are missing, these are bugs. | Now, every visible string shall start and end with an "x". If any are missing, these are bugs. | ||
=== | === Test via Automatic Localization Building === | ||
This approach requires several dependencies and essentially performs the steps above in an automated way. Moreover, with this approach also imported translations from dependencies are integrated. | This approach requires several dependencies and essentially performs the steps above in an automated way. Moreover, with this approach also imported translations from dependencies are integrated. | ||
# Check that in the main <code>CMakeLists.txt</code> file of your project the following macro is contained: <code>ki18n_install(po)</code> | # Check that in the main <code>CMakeLists.txt</code> file of your project the following macro is contained: <code>ki18n_install(po)</code> |
Latest revision as of 08:12, 9 June 2021
Useful Tools
- Lokalize
- Lokalize is a computer-aided translation system that focuses on productivity and quality assurance. It has components usual for CAT tools: translation memory, glossary, and also a unique translation merging (synchronization) capability. It is targeted for software translation and also integrates external conversion tools for freelance office document translation.
- Dr. Klash
- This little utility, once activated, can present a report about conflicting shortcuts in menus. Not only is this helpful for translators but also for developers. A little hand editing of `kde-config --localprefix`/share/config/kdeglobals activates this feature:
[Development]
CheckAccelerators=F12
AutoCheckAccelerators=false
AlwaysShowCheckAccelerators=false
- Pressing F12 will show a dialog containing which accelerators in the currently focussed interface conflict and provide suggestions for new accelerators. If no accelerators conflict or Dr. Klash has nothing to suggest, no popup dialog will be displayed.
- With AutoCheckAccelerators enabled the dialog will popup automatically if a conflict exists and AlwaysShowCheckAccelerators can force the dialog to always popup even if there are no conflicts to report.
- The x-test language
- This helper language serves as a debugging aid for people finding untranslated strings in applications. If you start your application with the "x-test" locale, all translated strings will appear with trailing and leading xx's. First you have to check out these "translations" from l10n-kf5/x-test and install them.
Test Localization in your Application
This section handles how you can check the localization of your application. In order to demonstrate how to test localization, we assume that your built "dolphin" by using kdesrc-build in ~/kde/build/dolphin/
.
After you've built l10n-kf5/x-test and installed it, run your application using the "x-test" locale. This can be done by launching it from the command line like this:
> LANG=x-test dolphin
This will start Dolphin using the "x-test" locale no matter what your current language setting is. Look for strings that do not have the xx's. If xx's are missing from a string, it could be due to missing i18n calls or even missing or incorrectly generated .pot files. Consult the i18n tutorials for further information.
When checking for untranslated strings, be sure to check all the WhatsThis help and tooltips.
Test via Manual Setup
- Check that in the main
CMakeLists.txt
file of your project the following macro is contained:ki18n_install(po)
- Go to your build directory and obtain the translation test files for the x-test language (see above) and put it into a subfolder named
po
- Reconfigure your project with cmake because the install commands for PO files are generated at configuration time
- Perform
make install
- Start your application with the x-test locale
As a code example this looks as follows:
cd ~/kde/build/dolphin/ mkdir -p po/x-test/ svn co svn://anonsvn.kde.org/home/kde/trunk/l10n-kf5/x-test/messages/dolphin cp dolphin/* po/x-test/ cmake . make install source ./prefix.sh LANGUAGE=x-test dolphin
Now, every visible string shall start and end with an "x". If any are missing, these are bugs.
Test via Automatic Localization Building
This approach requires several dependencies and essentially performs the steps above in an automated way. Moreover, with this approach also imported translations from dependencies are integrated.
- Check that in the main
CMakeLists.txt
file of your project the following macro is contained:ki18n_install(po)
- Go to your build directory and run
make fetch-translations
- Run
make install
and start your application as above.
Examining .po files
You can look at the translated .po files to see if a string is present and has been translated. For example, here's a portion of l10n/de/messages/kdebase/konqueror.po:
#: konq_mainwindow.cc:3707 konq_tabs.cc:84 msgid "&New Tab" msgstr "Neues &Unterfenster"
The string to be translated is given on the msgid line. The translated string is on the msgstr line. Notice that the exact same string to translate came from konq_mainwindow.cc and also from konq_tabs.cc. This saves the translators from having to translate the same identical string twice.
You can also use Lokalize to examine .po files. Lokalize is part of the kdesdk module.