The Keyman Desktop 7.0 Beta 2 UI is now both customizable and localizable.  Localization of the user interface is possible via editing a single XML file called locale.xml.

The default locale.xml file is in the folder

[Program Files]TavultesoftKeyman Desktop Professional 7.0xml

First steps to creating a translation

  1. Find the language code for your translation

    Use the ISO 639-2 or ISO 639-3 language code (we recommend using the ISO 639-3 codes as many Keyman keyboards support languages not included in ISO 639-2!).

  2. Create a folder for the translated locale.xml file and copy the default locale.xml into it

    The folder should be called:

      [Program Files]TavultesoftKeyman Desktop Professional 7.0localelangcode

File Format

The file format is straightforward – most strings have identifiers (e.g. SKButtonOK for the OK button).  The identifier of the string is the XML tag name.  We have three different types of strings in the file – plain, HTML and format strings.

  • Format strings often include %#:s or %#:d markers that are placeholders for parameters, and should be included in a translated string.  The order of the markers in the translated string is not important.
  • Plain strings must be just that – plain text.
  • HTML strings can include tags – there are only a few of these, and they are flagged in the locale.xml file.  The most obvious of these is in the Welcome screen text.

The only exception is the strings on the tray menu, which do not have identifiers, but instead use the following format (note that the Caption attribute should not include the & entity):

    <Menu Caption="Keyman Configuration…">localized &amp;text…</Menu>

The &amp; entity is used to mark hotkeys in menu items, labels and buttons.  It can be used only with strings identified as formatted messages (these mostly start with SK) and with the Menu strings.

Editing the File

First, edit the file’s language information – SKUILanguageName, SKUILanguageNameWithEnglish, and SKLanguageCode.

<!–   The name of the UI language, localized –>
<SKUILanguageName>
English</SKUILanguageName>

<!–   Show the name of the UI language, localised, with English name in parentheses (this message is used when the user gets stuck in a strange UI language) –>
<SKUILanguageNameWithEnglish>English</SKUILanguageNameWithEnglish>

<!–   The language code for the current translation –>
<SKLanguageCode>en</SKLanguageCode>

Note that any entries missing from the translated locale.xml will be retrieved from the default file.

Editing other Files

If you find that you need to do more work on the user interface, you can always copy the other files from the default xml folder into an xml subfolder of your locale folder, and edit them directly.  Note that the XSL file for each dialog (e.g. activate.xsl, or keyman.xsl) references other files – these other files must also be copied to the locale xml folder:

  [Program Files]TavultesoftKeyman Desktop Professional 7.0localelangcodexml

The format of these files is somewhat more complex; I may talk about them in the future.  But feel free to play around and edit!

Finally…

The Keyman Developer user interface is also localizable (not 100% ready yet), but it primarily uses gettext, with a small amount of translatable XSLT.  We will include the gettext .pot template in the release of Keyman Developer.

The usual beta warning applies – these file formats are not necessarily 100% stable, and some changes may occur.  However, we expect only that more strings will be added to the final locale.xml, and we don’t expect structural changes.

Categories: Developing Keyman

0 thoughts on “Translating the Keyman Desktop UI”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts

Developing Keyman

Keyman Update for 08 November 2024

This blog reports on significant Keyman product and keyboard development updates over the period from 28 October 2024 — 08 November 2024. As always, you can follow all of our development online at github.com/keymanapp/keyman, and Read more…

Developing Keyman

Keyman Update for 25 October 2024

This blog reports on significant Keyman product and keyboard development updates over the period from 14 October 2024 — 25 October 2024. As always, you can follow all of our development online at github.com/keymanapp/keyman, and Read more…

Developing Keyman

Keyman Update for 11 October 2024

This blog reports on significant Keyman product and keyboard development updates over the period from 30 September 2024 — 11 October 2024. As always, you can follow all of our development online at github.com/keymanapp/keyman, and Read more…