<h2>Currency Locale Troubleshooting</h2><br/><div style="overflow-x:auto"><article><div ><h3 >Issue </h3><section><p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-family: Times, serif;">There have been many open issues with currency. This article will help with the initial investigation.<br /><br /></span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><strong><span style="font-family: Times, serif;">How locale is determined:</span></strong></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-family: Times, serif;"> </span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-size: 10.5pt; font-family: Times, serif;">Locale can be defined as user level or at system level.</span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-size: 10.5pt; font-family: Times, serif;">Precedence order is –</span></p> <ol style="margin-bottom: 0in; margin-top: 0px; list-style-position: inside;"><li style="font-size: 10.5pt; font-family: Times, serif;">Locale as defined by language and country code in user record (language and country both must be specified in user record. User locale is combination of language + country code)</li><li style="font-size: 10.5pt; font-family: Times, serif;">Locale as defined by language code only in user record (use default locale for language)</li><li style="font-size: 10.5pt; font-family: Times, serif;">Locale as defined by glide.system.locale system property</li><li style="font-size: 10.5pt; font-family: Times, serif;">Locale as defined by your browser</li></ol> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-size: 8.0pt; font-family: Times, serif;"> </span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-size: 10.0pt; font-family: Times, serif;">Locale determines: Currency Formatting and Number Formatting </span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><a style="color: blue; text-decoration: underline;" href="https://docs.servicenow.com/csh?topicname=locales.html&version=latest"><span style="font-size: 8.0pt; font-family: Times, serif;">https://docs.servicenow.com/csh?topicname=locales.html&version=latest</span></a></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-size: 8.0pt; font-family: Times, serif;"> </span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-size: 10.0pt; font-family: Times, serif;">We're reliant on the underlying JVM locale and formatting code for actual rendering of things in the appropriate locale.</span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-size: 10.0pt; font-family: Times, serif;"> </span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-size: 10.0pt; font-family: Times, serif;">Java supported locales:</span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-size: 8.0pt; font-family: Times, serif;"> </span><a style="color: blue; text-decoration: underline;" href="https://www.oracle.com/technetwork/java/javase/javase7locales-334809.html"><span style="font-size: 8.0pt; font-family: Times, serif;">https://www.oracle.com/technetwork/java/javase/javase7locales-334809.html</span></a><span style="font-size: 8.0pt; font-family: Times, serif;"> </span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-size: 10.5pt; font-family: Times, serif;"> </span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><strong><span style="font-size: 10.5pt; font-family: Times, serif;">Example:</span></strong></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-size: 10.0pt; font-family: Times, serif;">When glide.system.locale property is set to any valid locale, for example, "de.CH", system generates country code as "System (CH)". Customers can add "CH" in country code sys_choice list.</span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-size: 9.0pt; font-family: Times, serif;"> </span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><strong><span style="font-size: 10.0pt; font-family: Times, serif;">Expected results:</span></strong></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-size: 10.0pt; font-family: Times, serif;">Setting User's country code to "System (CH)" and language to "de", will evaluate correct user locale "de_CH"</span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-size: 10.0pt; font-family: Times, serif;"> </span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><strong><span style="font-size: 10.0pt; font-family: Times, serif;">Unexpected results:</span></strong></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-size: 10.0pt; font-family: Times, serif;">If user's language is set to anything else, for example, "English" which evaluate to an invalid locale "en_CH"</span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-family: Times, serif;"> </span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-size: 10.5pt; font-family: Times, serif;">Some browsers (like firefox) will send in a browser locale with a language code, but among other things, a language code with no country code gives the java currency formatter class fits (illegal argument exceptions), So if the browser locale lacks a country or language code, the system will use the system default locale and the user will see inconsistent results. </span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-size: 10.5pt; font-family: Times, serif;"> </span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-size: 10.5pt; font-family: Times, serif;">Same case will work fine with safari as browser handles locale correctly. But if the user has an invalid locale, chrome ignores it </span><a style="color: blue; text-decoration: underline;" href="https://developer.chrome.com/extensions/i18n"><span style="font-family: Times, serif;">https://developer.chrome.com/extensions/i18n</span></a><span style="font-family: Times, serif;"> </span><span style="font-size: 10.5pt; font-family: Times, serif;"> and the user will not get expected results.</span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><strong><span style="font-size: 13.5pt; font-family: Times, serif;"> </span></strong></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><strong><span style="font-family: Times, serif;">In case of unexpected results, below settings should be checked:</span></strong></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-family: Times, serif;"> </span></p> <ol style="margin-bottom: 0in; margin-top: 0px; list-style-position: inside;"><li style="font-size: 10.5pt; font-family: Times, serif;">User language and country code should be a valid locale. </li><li style="font-size: 10.5pt; font-family: Times, serif;">glide.system.locale should be valid locale.</li><li style="font-size: 10.5pt; font-family: Times, serif;">If glide.i18n.languages plugin is installed, check for a language code synonym in the case where we have had to use an alternate language code. Locale is not necessarily the same thing as language as.</li></ol> <p style="margin: 0in 0in 0.0001pt 0.5in; text-align: justify; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-size: 10.5pt; font-family: Times, serif;">For example, <u>Quebequous</u> and <u>Frenchmen</u> both speak <u>French</u>, but use different number formatting rules. The value of "glide.i18n.language.synonym." + user language (2 character) and country code should be a valid locale, i.e., a locale listed at the Java supported locales URL above</span><span style="font-size: 9.0pt; font-family: Times, serif;">.</span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-family: Times, serif;"> </span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><span style="font-size: 10.5pt; font-family: Times, serif;">Another helpful article to refer to while using different currencies on an instance (KB0596448)</span><span style="font-family: Times, serif;"> </span></p> <p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;"><a style="color: blue; text-decoration: underline;" href="https://support.servicenow.com/kb_view.do?sys_kb_id=cf56a163dbc193c43882fb651f96195a"><span style="font-family: Times, serif;">https://support.servicenow.com/kb_view.do?sys_kb_id=cf56a163dbc193c43882fb651f96195a</span></a></p></section></div></article></div>