Splunk® Enterprise

Developing Views and Apps for Splunk Web

Splunk Enterprise version 8.1 will no longer be supported as of April 19, 2023. See the Splunk Software Support Policy for details. For information about upgrading to a supported version, see How to upgrade Splunk Enterprise.

UI internationalization

Internationalize the Splunk Web user interface.

  • 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 software translation

Splunk software uses the language settings for the browser where you are accessing Splunk Web. You can change the browser language settings to see the user interface in another language.

Locale strings indicate the language and location that Splunk software uses to translate the user interface. Typically, a locale string consists of two lowercase letters and two uppercase letters linked by an underscore. For example, en_US means American English while en_GB means British English.

Splunk software first tries to find an exact match for the full locale string but falls back to the language specifier if settings are not available for the full locale. For example, translations for fr answer to requests for fr_CA and fr_FR (French, Canada and France respectively).

In addition to language, translation also addresses the formatting of dates, times, numbers, and other localized settings.


Configuration

Splunk software uses the gettext internationalization and localization (i18n) system.

Steps

  1. Create a directory for the locale. For example, to create the fictional locale mz, create the following directory.
    $SPLUNK_HOME/lib/python2.7/site-packages/splunk/appserver/mrsparkle/locale/mz_MZ/LC_MESSAGES/
  2. Load the following messages.pot file into your PO editor.
    $SPLUNK_HOME/lib/python2.7/site-packages/splunk/appserver/mrsparkle/locale/messages.pot
  3. Use the PO editor to translate any strings that you want to localize. Save the file as messages.po in the directory you created in the previous step. The PO editor also saves a messages.mo file, which is the machine readable version of the PO file.
  4. Restart the Splunk instance. No other configuration file edits are required. Splunk software detects the new language files when it restarts.

Localization files

The Splunk platform stores localization information at the following location.

$SPLUNK_HOME/lib/python<version>/site-packages/splunk/appserver/mrsparkle/locale

This directory contains the following items.

  • messages.pot: Holds the strings to translate. You can use a PO editor to edit these files.
  • <locale_string>: Directory containing localization files for the locale specified by <locale_string> (for example, ja_JP).
  • <locale_string>/LC_MESSAGES/messages.po: Contains the source strings specified for localization in messages.pot. Using a PO editor, provide the translations for these strings.
  • <locale_string>/LC_MESSAGES/messages.mo: Machine readable version of messages.po. Splunk software uses this file to find translated strings. The PO editor creates the file for you when it creates the messages.po file.

Localize dates and numbers

You can format numbers and dates to the standards of a locale without translating any text. Create a directory for the locale whose numbers and dates you want to format. Copy the contents of the en_US directory to the target locale directory.

Example
Enable localization of numbers and dates for the de_CH locale (German – Switzerland).

Create the following target directory for the de_CH locale.

$SPLUNK_HOME/lib/python2.7/site-packages/splunk/appserver/mrsparkle/locale/de_CH

Copy the contents of the following directory.

$SPLUNK_HOME/lib/python2.7/site-packages/splunk/appserver/mrsparkle/locale/en_US 

Copy the contents from the en_US directory into the de_CH directory.

Translate Apps

You can use gettext to translate apps. Most apps must be translated in their own locale subdirectory.

Apps that ship with the Splunk platform are automatically extracted and their text is included in the core messages.pot file. You do not need to handle them separately.

To extract the strings from an installed app and make the strings ready for translation in a PO editor, run the following extraction command on the command line.

> splunk extract i18n -app <app_name>

This creates a locale/ subdirectory in the app root directory and populates it with a messages.pot file.

Follow the steps above to translate the strings within the app. When using views from a different app, the new messages.pot file contains the strings for these views.

Locale-specific resources

The Splunk platform stores static resources such as images, CSS files, and other media as subdirectories at the following location.

$SPLUNK_HOME/share/splunk/search_mrsparkle/exposed/

When serving these resources, Splunk software checks to see whether a localized version of the resource is available before falling back to the default resource. For example, if your locale is set to fr_FR, Splunk software searches for the logo image file in the following order.

  • 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 software 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 cannot accommodate (right to left text for example).

Last modified on 24 August, 2018
Customize dashboard styling and behavior   Developer resources

This documentation applies to the following versions of Splunk® Enterprise: 7.0.0, 7.0.1, 7.0.2, 7.0.3, 7.0.4, 7.0.5, 7.0.6, 7.0.7, 7.0.8, 7.0.9, 7.0.10, 7.0.11, 7.0.13, 7.1.0, 7.1.1, 7.1.2, 7.1.3, 7.1.4, 7.1.5, 7.1.6, 7.1.7, 7.1.8, 7.1.9, 7.1.10, 7.2.0, 7.2.1, 7.2.2, 7.2.3, 7.2.4, 7.2.5, 7.2.6, 7.2.7, 7.2.8, 7.2.9, 7.2.10, 7.3.0, 7.3.1, 7.3.2, 7.3.3, 7.3.4, 7.3.5, 7.3.6, 7.3.7, 7.3.8, 7.3.9, 8.0.0, 8.0.1, 8.0.2, 8.0.3, 8.0.4, 8.0.5, 8.0.6, 8.0.7, 8.0.8, 8.0.9, 8.0.10, 8.1.1, 8.1.2, 8.1.3, 8.1.4, 8.1.5, 8.1.6, 8.1.7, 8.1.8, 8.1.9, 8.1.13, 8.1.14, 8.2.0, 8.2.1, 8.2.2, 8.2.3, 8.2.4, 8.2.5, 8.2.6, 8.2.7, 8.2.8, 8.2.9, 8.2.10, 8.2.11, 8.2.12, 9.0.0, 9.0.1, 9.0.2, 9.0.3, 9.0.4, 9.0.5, 9.0.6, 9.0.7, 9.0.8, 9.0.9, 9.0.10, 9.1.0, 9.1.1, 9.1.2, 9.1.3, 9.1.4, 9.1.5, 9.1.6, 9.2.0, 9.2.1, 9.2.2, 9.2.3, 9.3.0, 9.3.1, 8.1.0, 8.1.10, 8.1.11, 8.1.12


Was this topic useful?







You must be logged into splunk.com in order to post comments. Log in now.

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters