Skip to main content
All CollectionsRule documentationMaintainability
Use of outdated API version for ICU locale

Use of outdated API version for ICU locale

Salesforce recommends using locale neutral code to keep formatting, parsing, and sorting consistent across environments.

David Martin avatar
Written by David Martin
Updated over a week ago

Summary

This rule flags Apex code that relies on JDK based locale logic (like Locale.getDefault() or DateFormat) instead of using locale neutral, Salesforce safe methods. To ensure your app behaves reliably across regions and remains compatible with Salesforce's evolving platform, always use standard Apex methods and apply locale formatting only at the final output stage.


Why It Matters

Salesforce is transitioning from Oracle’s JDK locale formats to ICU (International Components for Unicode). This shift affects how data types like dates, times, numbers, currency, and addresses are formatted based on user locale.

Additionally:

  • Users can change their locale at any time.

  • Locale definitions are regularly updated to meet new international standards.

  • JDK-based code is not guaranteed to behave consistently across Salesforce environments.

To avoid runtime errors and formatting inconsistencies, it’s essential to follow locale neutral coding practices.

Resources

Did this answer your question?