If you’re a Salesforce admin, you’ll likely see a pending release update in your Salesforce org about enabling ICU locale formats.
Below, we will discuss what this means and how it can be enabled for end users.
Why is an ICU locale format update needed?
Before the Winter ’20 release, new Salesforce orgs used the locale formats included with Oracle’s Java Development Kit (JDK). This “out of the box” solution works well, but it has a few issues. The JDK formats:
- Aren’t kept up-to-date regularly.
- Aren’t consistent with internationalization best practices.
- Aren’t available in newer versions of the JDK.
International Components for Unicode (ICU) is an international standard that’s maintained and governed by a global community. By adopting ICU, these concerns are all addressed.
Examples and side-by-side comparisons of the new format can be found here.
What does this mean for me?
The modern business landscape is increasingly globalized. Many companies, especially those that operate online, offer their services to customers from around the globe. Without some manner of standardization, timestamps can cause confusion across locales. Take, for instance, 21/06/12. Depending on where you live, this could read June 12, 2021, or it could be June 21, 2012. There may even be some that read it as December 6, 2021.
ICU Changes the way that dates, times, numbers, and currencies appear, using locale formats your customers are familiar with. Furthermore, it keeps date formats consistent across Salesforce as a whole.
Orgs created in Winter ’20 or later have ICU formats enabled by default. Any org created in Summer ’19 or earlier has JDK formats and can enable ICU formats through an update. ICU formats are available in API version 45.0 and later.
What do I need to do?
First, evaluate the impact to your org. Use this SOQL query to return the locales your org is using and a user count for each. See this article from Salesforce to see the changes specific to your locale.
Check Filters in Your Reports, Formulas, Validation, and Other Automated Workflows:
Check any date, number, or currency-based filters to make sure that they work properly with the new formats. Here are the issues you’re most likely to encounter:
- If you’ve used a “hard-wired” date/time value in a filter, the filter won’t work properly unless the value matches the new format.
- Some new formats introduce additional commas. This can confuse your filters, since commas are used to separate filter criteria.
You’ll also want to check any filters you’ve defined on fields in your objects, keeping the same considerations above in mind. You may have to modify filters using dates, times, and numbers.
Apex code should be tested as well. When testing, focus on methods that return formats based on the current locale, such as Date.format(), Date.parse(), DateTime.format(), DateTime.parse(), and DateTime.formatLong().
Consider this block of code :
Because this example passes the string argument ‘h:mm a’ to the format function, the dateTime is formatted according to the supplied format ‘h:mm a’, regardless of the locale. We recommend using this approach for formatting dates, times, and currencies when subsequent code expects a specific format.
If we don’t pass an argument to the format function, then the user’s locale determines the dateTime format. This approach is useful when producing information to display to the user.
Aura components will need to be checked as well. $Locale uses formats retrieved from Salesforce. Test these attributes thoroughly.
Finally, check your existing integrations with third-party apps. Most integrations store data in a neutral format, but some format data specifically for input and output.
Activate the Formats in Production
The feature can be enabled in the Salesforce org the same way as all other release updates.
Note that the English (Canada) locale (en_CA) requires separate activation. If you need to activate it, visit your Currency Display Settings and select Enable ICU formats for en_CA locale.
- Supported Number, Name, and Address Formats (ICU)
- Supported Date and Time Formats (ICU)
- Supported Currencies (ICU)
- ICU Documentation
Subscribe to our blog for more technical information and industry news.