protected void setupDefaults(StockChartGroup chart) { chart.setLanguage(messages.getTools().localeToString(userSessionSource.getLocale())); chart.setDataDateFormat(ChartJsonSerializationContext.DEFAULT_JS_DATE_FORMAT); }
protected void createLanguageLookup() { languageLookup = uiComponents.create(LookupField.TYPE_STRING); FieldGroup.FieldConfig languageLookupFc = fieldGroupRight.getFieldNN("language"); languageLookup.setDatasource(languageLookupFc.getTargetDatasource(), languageLookupFc.getProperty()); languageLookup.setRequired(false); Map<String, Locale> locales = configuration.getConfig(GlobalConfig.class).getAvailableLocales(); Map<String, String> options = new TreeMap<>(); for (Map.Entry<String, Locale> entry : locales.entrySet()) { options.put(entry.getKey(), messages.getTools().localeToString(entry.getValue())); } languageLookup.setOptionsMap(options); languageLookupFc.setComponent(languageLookup); }
String localeString = messages.getTools().localeToString(locale); String templateContent = getLocalizedTemplateContent(resources, serverErrorPageTemplatePath, localeString); if (templateContent == null) {
@Override public void accept(HasValue.ValueChangeEvent e) { if (active) { Locale selectedLocale = localesSelect.getValue(); String localeCode = messages.getTools().localeToString(selectedLocale); updateValues(getItem(), localeCode, (String) e.getValue()); } }
@Override protected void initNewItem(User item) { addDefaultRoles(item); item.setLanguage(messages.getTools().localeToString(userSession.getLocale())); initUserGroup(item); }
protected void initLocale() { UserSessionSource userSessionSource = AppBeans.get(UserSessionSource.class); Locale locale = userSessionSource.getLocale(); String localeString = messages.getTools().localeToString(locale); if (!Objects.equals(localeString, component.getLocaleString())) { component.setPivotTableMessages(localeString, PivotTableLocaleHelper.getPivotTableLocaleMap(locale)); component.setLocaleString(localeString); component.setEmptyDataMessage(messages.getMainMessage("pivottable.emptyDataMessage", locale)); } }
protected void setupChartLocale(AbstractChart chart) { chart.setLanguage(messages.getTools().localeToString(userSessionSource.getLocale())); // number formatting FormatStrings formatStrings = Datatypes.getFormatStrings(userSessionSource.getLocale()); if (formatStrings != null) { DecimalFormatSymbols formatSymbols = formatStrings.getFormatSymbols(); chart.setPrecision(-1); chart.setPercentPrecision(2); chart.setDecimalSeparator(Character.toString(formatSymbols.getDecimalSeparator())); chart.setThousandsSeparator(Character.toString(formatSymbols.getGroupingSeparator())); } // number prefixes List<BigNumberPrefix> bigPrefixes = new ArrayList<>(); for (BigNumberPower power : BigNumberPower.values()) { bigPrefixes.add(new BigNumberPrefix(power, messages.getMainMessage("amcharts.bigNumberPower." + power.name()))); } chart.setPrefixesOfBigNumbers(bigPrefixes); List<SmallNumberPrefix> smallPrefixes = new ArrayList<>(); for (SmallNumberPower power : SmallNumberPower.values()) { smallPrefixes.add(new SmallNumberPrefix(power, messages.getMainMessage("amcharts.smallNumberPower." + power.name()))); } chart.setPrefixesOfSmallNumbers(smallPrefixes); }
Locale locale = userSessionSource.getLocale(); String localeCode = messages.getTools().localeToString(locale); userCaption = localizedMessage.getLocalizedCaption(localeCode); userMessage = localizedMessage.getLocalizedMessage(localeCode);
protected void initLocale() { CubaAmchartsIntegration amchartsIntegration = CubaAmchartsIntegration.get(); if (amchartsIntegration.getSettings() == null || !Objects.equals(userSessionSource.getLocale(), amchartsIntegration.getLocale())) { Settings settings = new Settings(); Locale locale = userSessionSource.getLocale(); // chart String localeString = messages.getTools().localeToString(locale); amchartsIntegration.setChartMessages(localeString, ChartLocaleHelper.getChartLocaleMap(locale)); // export amchartsIntegration.setExportMessages(localeString, ChartLocaleHelper.getExportLocaleMap(locale)); amchartsIntegration.setSettings(settings); amchartsIntegration.setLocale(userSessionSource.getLocale()); } }
protected void initLocale() { CubaAmchartsIntegration amchartsIntegration = CubaAmchartsIntegration.get(); if (amchartsIntegration.getSettings() == null || !Objects.equals(userSessionSource.getLocale(), amchartsIntegration.getLocale())) { Settings settings = new Settings(); Locale locale = userSessionSource.getLocale(); // chart String localeString = messages.getTools().localeToString(locale); amchartsIntegration.setChartMessages(localeString, ChartLocaleHelper.getChartLocaleMap(locale)); // export amchartsIntegration.setExportMessages(localeString, ChartLocaleHelper.getExportLocaleMap(locale)); amchartsIntegration.setSettings(settings); amchartsIntegration.setLocale(userSessionSource.getLocale()); } }
protected Consumer<HasValue.ValueChangeEvent<Locale>> createLocaleSelectValueChangeListener() { return e -> { captionValueChangeListener.suspend(); messageValueChangeListener.suspend(); Locale selectedLocale = (Locale) e.getValue(); String localeCode = messages.getTools().localeToString(selectedLocale); caption.setValue(getItem().getLocalizedCaption(localeCode)); message.setValue(getItem().getLocalizedMessage(localeCode)); captionValueChangeListener.resume(); messageValueChangeListener.resume(); }; }
protected void initLocale() { UserSessionSource userSessionSource = AppBeans.get(UserSessionSource.class); CubaAmchartsIntegration amchartsIntegration = CubaAmchartsIntegration.get(); if (amchartsIntegration.getSettings() == null || !Objects.equals(userSessionSource.getLocale(), amchartsIntegration.getLocale())) { Settings settings = new Settings(); Locale locale = userSessionSource.getLocale(); // chart String localeString = messages.getTools().localeToString(locale); amchartsIntegration.setChartMessages(localeString, ChartLocaleHelper.getChartLocaleMap(locale)); // export amchartsIntegration.setExportMessages(localeString, ChartLocaleHelper.getExportLocaleMap(locale)); amchartsIntegration.setSettings(settings); amchartsIntegration.setLocale(userSessionSource.getLocale()); } }
chart.setLanguage(messages.getTools().localeToString(userSessionSource.getLocale()));
TreeMap<String, String> options = new TreeMap<>(); for (Map.Entry<String, Locale> entry : locales.entrySet()) { options.put(entry.getKey(), messages.getTools().localeToString(entry.getValue()));