Skip to content

Multi language Support

Ladislav edited this page Jul 2, 2024 · 9 revisions

QLog has a multi-language support. The language is set based on the OS environment setting.

Currently, following languages are implemented:

  • English
  • Czech
  • German
  • Spanish

The language can also be set manually via OS's locales or input parameters. An example below shows, how the language can be changed manually via Linux OS environment setting:

LANG=cs_CZ.UTF-8 ./qlog (for Czech Language)

LANG=de_DE.UTF-8 ./qlog (for German Language)

For Windows platform, set the LANG environment variable for application or use:

set LANG=cs_CZ.UTF8
qlog.exe

The language can also be set via QLog's input parameters. QLog contains two input parameters to control the language:

-t, --translation <path/QM-filename>

-t is implemented mainly for translators who want to test their translations that are not part of QLog. Just enter the absolute or relative path and name of the QM file with the translation, and this translation file will then be used by QLog, e.g., -t /home/qloguser/qlog_cs.qm.

-l, --language <code>

The -l parameter can set a language. If the parameter is set, then the OS environment setting is ignored, e.g., -l cs or -l cs_CZ.

QLog includes built-in translation files. It is also possible to place the translation files outside of QLog. QLog searches the following directories for translation files.

OS Type Directories
Linux application folder/i18n
~/.local/share/hamradio/QLog/i18n
/usr/local/share/hamradio/QLog/i18n
/usr/share/hamradio/QLog/i18n
build-in QLog translation files
Linux (flatpak) effectively only ~/.var/app/io.github.foldynl.QLog/data/hamradio/QLog/i18n
Windows <APPDIR>/i18n
C:/Users/<USER>/AppData/Local/hamradio/QLog/i18n
C:/ProgramData/hamradio/QLog/i18n
<APPDIR>/data/i18n
<APPDIR>/data/hamradio/QLog/i18n
MacOS TODO - must be confirmed
<APPDIR>/i18n
~/Library/Application Support/hamradion/QLog/i18n
/Library/Application Support/hamradio/QLog/i18n
<APPDIR>/../Resources/i18n

The external translation files must be named in this format: qlog_<lang code>.qm, where <lang code> can be in short or long form, e.g., cs or cs_CZ.

Date & Time Format

Not only language but also date and time format and distance unit are controlled by OS environment settings. If you wish to use a date and time format different from your language's default, please refer to the following examples:

Date in ISO format (YYYY-MM-DD):

LC_TIME=en_SE.UTF-8

Distance Unit

The distance unit is controlled via LC_MEASUREMENT. All Non-metric units are in miles, and the metric unit is in km.

How to Create a Translation File

QLog is a community project. Sharing your translations with the community helps us grow and improve together. Therefore, every GitHub pull request (PR) with translation files will be highly appreciated.

Do you have no experience with application development but want to help to translate QLog?

  1. Send an email to the main developer (OK1MLG) requesting a translation file. Include the language you want to translate.
  2. The translation file will be send as soon as possible.
  3. Download and Install Qt Linguist (if you don't already have it). It is available as a QT component or it is a part of your Linux distribution. For Windows users it is possible to install standalone application.
  4. Open the .ts file in it. Translate the strings to your language and save the file.
  5. Test your translation file. Generate .qm file via Qt Linguist (FileRelease As...). Then start QLog with an input parameter -t <path/QM-filename>
  6. Once you have completed the .ts file send back the .ts file via email.

Do you already have some experience with development?

  1. Clone the QLog repository
  2. Modify the QLog.pro file and add the new language to the TRANSLATIONS section.
TRANSLATIONS = i18n/qlog_cs.ts \
               i18n/qlog_de.ts \
               i18n/qlog_es.ts \
               i18n/qlog_zh_CN.ts \
               i18n/qlog_<<LANG CODE>>.ts
  1. Generate the Translation Source File. Run lupdate to generate .ts file in the i18n directory.
lupdate -no-obsolete QLog.pro
  1. Translate the newly created ts. in Qt Linguist
  2. Test your translation file. Generate .qm file via Qt Linguist (FileRelease As...). Then start QLog with an input parameter -t <path/QM-filename>
  3. Once you have completed the .ts file, generate GitHub Pull Request or send back the .ts file via email to the main developer (OK1MLG).
Clone this wiki locally