com.codename1.l10n.package.html Maven / Gradle / Ivy
The Localization API allows developers to adapt their applications to different geographic locales and
conventions.
Portable Localization
Most of the classes within this package are clones of Java SE classes such as {@link com.codename1.l10n.SimpleDateFormat}
vs. {@link java.text.SimpleDateFormat}. The main motivation of placing these classes here and using the
cloned version is portability.
If we would use {@link java.text.SimpleDateFormat} its behavior would be slightly different on Android
or in the simulator vs. its behavior on iOS. That is because the implementation would be radically different.
When you use {@link com.codename1.l10n.SimpleDateFormat} the implementation might be missing
some pieces but it would be more consistent with the implementation you would get on the device which
is always preferable.
L10NManager
The localization manager allows adapting values for display in different locales thru parsing and formatting
capabilities (similar to JavaSE's DateFormat/NumberFormat). It also includes language/locale/currency
related API's similar to Locale/currency API's from JavaSE.
The sample code below just lists the various capabilities of the API: