Created
March 4, 2016 12:44
-
-
Save codenameone/6d93edd5e6b69e7c088a to your computer and use it in GitHub Desktop.
Sample of localization setting code in Codename One
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Form hi = new Form("L10N", new TableLayout(16, 2)); | |
L10NManager l10n = L10NManager.getInstance(); | |
hi.add("format(double)").add(l10n.format(11.11)). | |
add("format(int)").add(l10n.format(33)). | |
add("formatCurrency").add(l10n.formatCurrency(53.267)). | |
add("formatDateLongStyle").add(l10n.formatDateLongStyle(new Date())). | |
add("formatDateShortStyle").add(l10n.formatDateShortStyle(new Date())). | |
add("formatDateTime").add(l10n.formatDateTime(new Date())). | |
add("formatDateTimeMedium").add(l10n.formatDateTimeMedium(new Date())). | |
add("formatDateTimeShort").add(l10n.formatDateTimeShort(new Date())). | |
add("getCurrencySymbol").add(l10n.getCurrencySymbol()). | |
add("getLanguage").add(l10n.getLanguage()). | |
add("getLocale").add(l10n.getLocale()). | |
add("isRTLLocale").add("" + l10n.isRTLLocale()). | |
add("parseCurrency").add(l10n.formatCurrency(l10n.parseCurrency("33.77$"))). | |
add("parseDouble").add(l10n.format(l10n.parseDouble("34.35"))). | |
add("parseInt").add(l10n.format(l10n.parseInt("56"))). | |
add("parseLong").add("" + l10n.parseLong("4444444")); | |
hi.show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample usage of L10NManager class.
From the Codename One project