EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

KB440717: Adding a new locale with a specific Date format to MicroStrategy Web with the Web SDK


Community Admin

• Strategy


A full demonstration on how to add a new language/locale to MicroStrategy Web with a custom date formatter for prompt settings.

This article demonstrates the process of making a new locale available in the Web Preferences, as well as configuring the date format, such as the one used in a date prompt. The process of adding a new locale is a 3 part process:

  • Registering a new locale in the metadata.
  • Adding this locale to the drop-down in the Strategy Web language preferences.
  • Specify the date & number formatting for when this locale is used in Strategy Web.


This specific example will demonstrate the process of making Czech a selectable locale in the Strategy Web internationlization settings.

Registering a new locale in the metadata


This is a prerequisite to making the locale usable in Strategy Web and requires Strategy Developer:

  • Open Strategy Developer and login as the administrator.
  • Navigate through the project source to the list of languages: Administration -> Configuration Managers -> Languages.

​

ka04W00000148D0QAI_0EM44000000WLRV.png


 

  • Click the "New Language" button to add a new language: 

​

ka04W00000148D0QAI_0EM44000000WLRa.png
  • From the list of available languages, choose the language being added and click OK:

​

ka04W00000148D0QAI_0EM44000000WLRf.png
  • The language should now be available in the list of languages shown in Strategy Developer:
ka04W00000148D0QAI_0EM44000000WLRk.png

Note: To apply these changes the Intelligence Server will need to be restarted. The language has now been registered in the metadata.

Adding this locale to the Strategy Web language preferences


Once the locale has been registered in the metadata, a customization has to be created, adding the locale to the locales.xml. This change needs to be made within a plugin.

  • Open the Web Customization Editor and create a new plugin - for example "Locales".
  • Copy the original locales.xml from Strategy Web into the plugin:
    • In the file system hosting Strategy Web, to "Strategy Web / WEB-INF / xml".
    • Make a copy of the file "locales.xml".
    • Paste the copy of the "locales.xml" file into "Strategy Web / plugins / yourPlugin / WEB-INF / xml".
  • The resulting file structure may look similar to the following:
ka04W00000148D0QAI_0EM44000000WLRu.png

​

  • Edit the locales.xml within the plugin in a plain text editor.


Each <locale /> tag represents an individual locale available in Strategy Web. Existing locales in this file can be used as a template/example for a newly added locale. 
In this example, duplicate the locale tag for "Deutsch" - this duplicated existing locale will be edited to create the locale for "Czech":


<locale locale-id="1031" language="de" country="DE" desc="Deutsch" desc-id="mstrWeb.949" char-set="UTF-8" char-set-excel="UnicodeLittle" codepage="65001" codepage-excel="1252" />

Locales and locale IDs are 3rd party concepts not specific to Strategy. A quick search online for "locale DE 1031", based on this locale definition for "Deutsch", will show a few links with more information. One of the top results will show the following variables specific to "de DE":

ka04W00000148D0QAI_0EM44000000WLSE.png

From the values we see here, we see matches to the existing locale's locale-id, language, country, and codepage-excel value. Searching on this page for Czech will show the corresponding values for the new locale:

ka04W00000148D0QAI_0EM44000000WLSO.png

Following the same pattern, the resulting locale tag looks as such:


<locale locale-id="1029" language="cs" country="CS" desc="Czech" desc-id="mstrWeb.949" char-set="UTF-8" char-set-excel="UnicodeLittle" codepage="65001" codepage-excel="1250" />

Save and close the locales.xml from the plugin. Next we need to configure the plugin to use the locales.xml copy inside the plugin, instead of the default built-in locales.xml:

  • Open the Web Customization Editor.
  • Navigate through Strategy Web Configuration -> Web Configuration Settings -> Strategy Configuration Settings.
  • In the "Global Settings" tab, click the "..." button next to the Locales setting, pointing this to the locales.xml within the plugin:
ka04W00000148D0QAI_0EM44000000WLST.png
  • The setting shown after the change: 
ka04W00000148D0QAI_0EM44000000WLSY.png
  • Save your changes and restart the web server (e.g tomcat). This step will make Czech available within the languages drop down in the Strategy Web preferences.


Note: this step only makes the locale selectable - further action is required to provide the correct date & number formatting.

Specify the Date & Number formatting for this locale


To define the date & number formattings for a specific locale, another file needs to be copied to the customization.

  • Copy the original format_config.xml from Strategy Web into the plugin:
    • In the file system hosting Strategy Web, to "Strategy Web / WEB-INF / xml".
    • Make a copy of the file "format_config.xml".
    • Paste the copy of the "format_config.xml" file into "Strategy Web / plugins / yourPlugin / WEB-INF / xml".
  • The resulting file structure may look similar to the following:
ka04W00000148D0QAI_0EM44000000WLSd.png

 
This file can now be edited within the isolated safety of the plugin to add specific settings for the newly added locale.

  • Edit format_config.xml from the plugin in a plain text editor.
  • Existing locales are perfect examples on the syntax. Make a new copy of the definition for the "de DE" locale, which by default looks as follows:


<locale language="de" country="DE">
		<list-separator>;</list-separator>
		<data-type name="integer">
			<out>###0</out>
			<in>#.##0</in>
                        <!-- display node for this data type currently not in use -->
			<display>###0</display>
		</data-type>
		<data-type name="number">
			<out>###0,##########</out>
			<in>#.##0,###</in>
            <in>0,###E0</in>
                        <!-- display node for this data type currently not in use -->
			<display>###0,##########</display>
		</data-type>
		<data-type name="date">
			<out>dd.MM.yyyy</out>
			<in>d.M.yy</in>
			<in>d.M.yyyy</in>
			<in>yyyy-M-d</in>
			<display>dd.MM.yy</display>
		</data-type>
		<data-type name="time">
			<out>HH:mm:ss</out>
			<in>HH:mm</in>
			<in>HH:mm:ss</in>
			<in>HH:mm 'Uhr'</in>
			<in>HH:mm:ss z</in>
                        <display>HH:mm:ss</display>
		</data-type>
	</locale>

Important: we're making and editing a copy of the <locale language="de" country="DE"> tag and its contents, we're not editing the only version of this tag in this file.

  • From the existing "de DE" locale in locales.xml, we see that the "language" and "country" property is an exact match to the definition in the locales.xml file.
  • As a reminder, this is the Czech locale previously added:


<locale locale-id="1029" language="cs" country="CS" desc="Czech" desc-id="mstrWeb.949" char-set="UTF-8" char-set-excel="UnicodeLittle" codepage="65001" codepage-excel="1250" />

  • In the duplicated locale tag in the plugin copy of the format_config.xml, edit the language and country property to match the new locale:


<locale language="cs" country="CS">
		<list-separator>;</list-separator>
		<data-type name="integer">
			<out>###0</out>
			<in>#.##0</in>
                        <!-- display node for this data type currently not in use -->
			<display>###0</display>
		</data-type>
		<data-type name="number">
			<out>###0,##########</out>
			<in>#.##0,###</in>
            <in>0,###E0</in>
                        <!-- display node for this data type currently not in use -->
			<display>###0,##########</display>
		</data-type>
		<data-type name="date">
			<out>dd.MM.yyyy</out>
			<in>d.M.yy</in>
			<in>d.M.yyyy</in>
			<in>yyyy-M-d</in>
			<display>dd.MM.yy</display>
		</data-type>
		<data-type name="time">
			<out>HH:mm:ss</out>
			<in>HH:mm</in>
			<in>HH:mm:ss</in>
			<in>HH:mm 'Uhr'</in>
			<in>HH:mm:ss z</in>
                        <display>HH:mm:ss</display>
		</data-type>
	</locale>

  • The rest of the settings in the format_config correspond to the formatting used when this locale is active.
  • To change the date format to dd-MM-yyyy, the following changes are made within the "data-type name = date" tag:
    • The "out" tag is edited to the desired date format.
    • The "display" tag is also edited to the desired date format.
    • For the "in" tag, we duplicate an existing one and edit the duplicate to the desired date format.
  • This is the resulting locale in the format_config after completing these changes:


<locale language="cs" country="CS">
		<list-separator>;</list-separator>
		<data-type name="integer">
			<out>###0</out>
			<in>#.##0</in>
                        <!-- display node for this data type currently not in use -->
			<display>###0</display>
		</data-type>
		<data-type name="number">
			<out>###0,##########</out>
			<in>#.##0,###</in>
            <in>0,###E0</in>
                        <!-- display node for this data type currently not in use -->
			<display>###0,##########</display>
		</data-type>
		<data-type name="date">
			<out>dd-MM-yyyy</out>
			<in>dd-MM-yyyy</in>
			<in>d.M.yy</in>
			<in>d.M.yyyy</in>
			<in>yyyy-M-d</in>
			<display>dd-MM-yyyy</display>
		</data-type>
		<data-type name="time">
			<out>HH:mm:ss</out>
			<in>HH:mm</in>
			<in>HH:mm:ss</in>
			<in>HH:mm 'Uhr'</in>
			<in>HH:mm:ss z</in>
                        <display>HH:mm:ss</display>
		</data-type>
	</locale>

The plugin now needs to be configured to use the custom format_config.xml instead of the default built-in version of this file. Once again, this change can be made using the Web Customization Editor:

  • Open the Web Customization Editor.
  • Navigate through Strategy Web Configuration -> Web Configuration Settings -> Strategy Configuration Settings.
  • In the "Global Settings" tab, click the "..." button next to the "Server Formatter" setting, pointing this to the format_config.xml within the plugin:
ka04W00000148D0QAI_0EM44000000WLSi.png
  • Save these changes and restart Strategy Web to apply the customization changes.

Results


The locale is now selectable within the language preferences within Strategy Web:

ka04W00000148D0QAI_0EM44000000WLSn.png

After saving any preference changes, logging out and back into Strategy Web, executing a report with a date prompt now shows the date in the desired format:

ka04W00000148D0QAI_0EM44000000WLSx.png

 

Important Notes

  • ​The locale ID is a 3rd party concept. A full list of locales and their corresponding ID values can be found online.
  • The language needs to be added in the metadata, or it may not appear in the web preferences after the other steps are completed.
    • The intelligence server needs to be restarted after this change.
  • The "language" and "country" properties act similar to primary keys within the locales.xml and format_config.xml.
    • These values are case sensitive.
    • A mismatch between these values across both files will result in Strategy Web using default locale formatting (likely to be en_US).
    • If Strategy Web is showing default formatting, verify that these properties in both locale tags in the locales.xml & format_config.xml match perfectly.
  • Any changes made to XML files require a restart of the Web server (e.g tomcat), or they may not register completely.
  • While built-in XML files could be edited directly without a plugin, this is not recommended. If Strategy Technical Support is later involved in a related issue, you may be required to revert Strategy Web and recreate your customization in the safety of a plugin.
  • After changing the locale setting in the Strategy Web preferences, the session needs to be recreated for the changes to take effect.

The example provided in this document is provided “as-is” and assumes the user has read the following customization warning:
ADDITIONAL INFORMATION:
The Strategy SDK allows you to customize several Strategy products and extend and integrate the Strategy business intelligence functionality into other applications. However, before changing the way Strategy products look or behave, it is helpful to understand how the application is built. For more information regarding the Strategy products or the process of customizing Strategy products, please refer to Strategy Developer Zone (https://developer.microstrategy.com).
To access the Strategy Developer Zone, you must have access to the Strategy Knowledge Base, you must have purchased the Strategy SDK, and you must be current on your Strategy maintenance agreement. If you are a US-based business and believe that you satisfy all three of these conditions but you do not have access to the Strategy Developer Zone, please contact Strategy Technical Support at support@microstrategy.com or at (703) 848-8700. If you are an international business, please contact Strategy Technical Support at the appropriate email address or phone number found at https://www.microstrategy.com/us/services/support/contact.
CUSTOMIZATION WARNING:This customization is provided as a convenience to Strategy users and is only directly applicable to the version stated. While this code may apply to other releases directly, Strategy Technical Support makes no guarantees that the code provided will apply to any future or previous builds. In the event of a code change in future builds, Strategy Technical Support makes no guarantee that an updated version of this particular customization will be provided. In the event of a code change in future builds, Strategy may not be able to provide additional code on this matter even though this customization is provided at this time for this specific build. For enhancements to this customization or to incorporate similar functionality into other versions, contact your Account Executive to inquire about Strategy Consulting assistance.


Comment

0 comments

Details

Knowledge Article

Published:

April 30, 2018

Last Updated:

May 1, 2018