Search in sources :

Example 1 with Locale

use of net.rim.device.api.i18n.Locale in project CodenameOne by codenameone.

the class BlackBerryImplementation method getLocalizationManager.

/**
 * @inheritDoc
 */
public L10NManager getLocalizationManager() {
    if (l10n == null) {
        Locale l = Locale.getDefault();
        l10n = new L10NManager(l.getLanguage(), l.getCountry()) {

            public String format(int number) {
                return super.format(number);
            }

            public String format(double number) {
                return super.format(number);
            }

            public String formatCurrency(double currency) {
                return super.formatCurrency(currency);
            }

            public String formatDateLongStyle(Date d) {
                return DateFormat.getInstance(DateFormat.DATE_LONG).format(d);
            }

            public String formatDateShortStyle(Date d) {
                return DateFormat.getInstance(DateFormat.DATE_SHORT).format(d);
            }

            public String formatDateTime(Date d) {
                String date = DateFormat.getInstance(DateFormat.DATE_FULL).format(d);
                String time = DateFormat.getInstance(DateFormat.TIME_FULL).format(d);
                return date + " " + time;
            }

            public String getCurrencySymbol() {
                return super.getCurrencySymbol();
            }

            public void setLocale(String locale, String language) {
                super.setLocale(locale, language);
                Locale.setDefault(Locale.get(language, locale));
            }
        };
    }
    return l10n;
}
Also used : Locale(net.rim.device.api.i18n.Locale) Date(java.util.Date) L10NManager(com.codename1.l10n.L10NManager)

Aggregations

L10NManager (com.codename1.l10n.L10NManager)1 Date (java.util.Date)1 Locale (net.rim.device.api.i18n.Locale)1