use of com.haulmont.chile.core.datatypes.FormatStrings in project cuba by cuba-platform.
the class SiteSettings method getFreeMarkerSettings.
public Properties getFreeMarkerSettings() {
Configuration configuration = AppBeans.get(Configuration.NAME);
GlobalConfig globalConfig = configuration.getConfig(GlobalConfig.class);
Map<String, Locale> availableLocales = globalConfig.getAvailableLocales();
if (availableLocales.isEmpty())
throw new IllegalStateException("Property cuba.availableLocales is not configured");
Locale locale = availableLocales.values().iterator().next();
FormatStrings formatStrings = Datatypes.getFormatStrings(locale);
final Properties freemarkerSettings = new Properties();
freemarkerSettings.setProperty("number_format", "#");
freemarkerSettings.setProperty("datetime_format", formatStrings.getDateTimeFormat());
freemarkerSettings.setProperty("date_format", formatStrings.getDateFormat());
freemarkerSettings.setProperty("template_exception_handler", "rethrow");
return freemarkerSettings;
}
Aggregations