Translate Splunk
This documentation does not apply to the most recent version of Splunk. Click here for the latest version.
Translate Splunk
Splunk now supports internationalizing and localizing strings within the product. Use Splunk's localization tools to:
- Translate text generated by Python code, JavaScript code, views, menus and Mako templates.
- Set language/locale specific alternatives for static resources such as images, CSS, other media.
- Create new languages or locales.
- Format times, dates and other numerical strings.
Splunk automatically detects every time you log in and uses whatever language your browser is set to. If you'd like to switch languages, change your browser settings.
Splunk detects locale strings. A locale string contains two components: a language specifier and a localization specifier. This is usually presented as two lowercase letters and two uppercase letters linked by an underscore. For example, en_US means US English or en_GB for British English. When looking for a suitable translation, Splunk first tries to find an exact match for the whole locale, but will fallback to just the language specifier the entire setting is not available. For example, translations for 'fr' answer to requests for fr_CA and fr_FR. The user's locale also affects how dates, times, numbers etc are formatted as different countries have differing standards on how these entities are formatted.
Configuration
To translate Splunk, follow these directions:
1. First, you'll need a PO editor. We recommend Poedit, a free, cross-platform PO editor.
2. Next, make a new directory for the locale you're creating. For example, we'll create the fictional locale mz by creating the directory$SPLUNK_HOME/lib/python2.6/site-packages/splunk/appserver/mrsparkle/locale/mz_MZ/LC_MESSAGES/
3. Now, create the messages.po and messages.mo files in your locale subdirectory.
4. Use your PO editor to translate any strings you wish to your locale.
5. Restart Splunk. There are no other configuration files to edit; the new language will be detected automatically.
Relevant files
Translation information is stored in$SPLUNK_HOME/lib/python2.6/site-packages/splunk/appserver/mrsparkle/in the following three files:
- messages.pot
- This file holds all of the strings that need to be translated; load this into your po editor to get started.
- locale/<locale>/LC_MESSAGES/messages.po
- Replace <local> is the locale you're translating to.
- Your editor creates this file mapping source strings to the translation you provide.
- locale/</locale>/LC_MESSAGES/messages.mo
- A machine readable version of messages.po that the system uses to find translated strings.
- Your po editor should create this for you at the same time as the .po file
Translate Apps
Apps can also be translated using the above steps. However, most Apps must be translated in their own locale subdirectory. Apps that ship with Splunk (Search, Launcher, Unix) are automatically extracted and their text is included in the core messages.pot file; there's no need to handle them separately.
To extract the strings from an installed application, ready to be translated in your PO editor, run the following command from Splunk's command line:
- splunk extract i18n -app <appname>
This creates a locale/ subdirectory in the App's root directory and populates it with a messages.pot file. Then, follow the steps above to translate the strings within the App.
Locale-specific resources
Static resources such as images, CSS files, and other media are stored in subdirectories within$SPLUNK_HOME/share/splunk/search_mrsparkle/exposed/When serving these resources, Splunk checks to see whether a locale-specific version of the resource is available before falling back to the default resource. For example, if your local is set to fr_FR, Splunk look in the following order for the logo image file:
- exposed/img/skins/default/logo-mrsparkle-fr_FR.gif
- exposed/img/skins/default/logo-mrsparkle-fr.gif
- exposed/img/skins/default/logo-mrsparkle.gif
Splunk follows the same path to load HTML templates (including any views) that define each page in the UI. This can be useful for languages that require a modified layout that CSS alone can't accommodate (right to left text for example).
This documentation applies to the following versions of Splunk: 4.0 , 4.0.1 , 4.0.2 , 4.0.3 , 4.0.4 , 4.0.5 , 4.0.6 , 4.0.7 , 4.0.8 , 4.0.9 , 4.0.10 , 4.0.11 View the Article History for its revisions.