List of usage examples for org.apache.commons.lang3 SystemUtils USER_COUNTRY
String USER_COUNTRY
To view the source code for org.apache.commons.lang3 SystemUtils USER_COUNTRY.
Click Source Link
The user.country or user.region System Property.
From source file:com.github.aynu.mosir.core.standard.util.PropertiesHelper.java
/** * ????/* w ww .j a v a 2 s . com*/ * @param baseName ?? * @return ?? */ private PropertiesConfiguration getPropertiesConfiguration(final String baseName) { final String languageTag = String.format("%s-%s", SystemUtils.USER_LANGUAGE, SystemUtils.USER_COUNTRY); final Control control = Control.getControl(Control.FORMAT_DEFAULT); final Collection<Locale> locales = control.getCandidateLocales("messages", Locale.forLanguageTag(languageTag)); final StringBuilder builder = new StringBuilder(); for (final Locale locale : locales) { final String bundleName = control.toBundleName(baseName, locale); final String resourceName = control.toResourceName(bundleName, "properties"); final URL url = getClass().getResource("/" + resourceName); // final URL url = ClassLoader.getSystemResource(resourceName); if (url != null) { if (builder.length() > 0) { LOG.debug("Resource could not be found ({}).", builder.toString()); } LOG.debug("Resource could be found ({}).", resourceName); try { return new PropertiesConfiguration(url); } catch (final ConfigurationException e) { throw new RuntimeException(e); } } builder.append(" " + resourceName); } throw new RuntimeException(String.format("PROPERTY is NOT_FOUND. [baseName=%s]", baseName)); }
From source file:com.github.aynu.yukar.framework.util.PropertiesHelper.java
/** * ????/*from ww w.j ava 2 s.c om*/ * @param baseName ?? * @return ?? */ private PropertiesConfiguration getPropertiesConfiguration(final String baseName) { final String languageTag = String.format("%s-%s", SystemUtils.USER_LANGUAGE, SystemUtils.USER_COUNTRY); final Control control = Control.getControl(Control.FORMAT_DEFAULT); final Collection<Locale> locales = control.getCandidateLocales("messages", Locale.forLanguageTag(languageTag)); final StringBuilder builder = new StringBuilder(); for (final Locale locale : locales) { try { final String bundleName = control.toBundleName(baseName, locale); final String resourceName = control.toResourceName(bundleName, "properties"); final URL url = getClass().getResource("/" + resourceName); // final URL url = ClassLoader.getSystemResource(resourceName); if (url != null) { if (builder.length() > 0) { LOG.debug("Resource could not be found ({}).", builder.toString()); } LOG.debug("Resource could be found ({}).", resourceName); return new PropertiesConfiguration(url); } builder.append(" " + resourceName); } catch (final ConfigurationException e) { LOG.warn(e.toString(), e); throw new StandardRuntimeException(e); } } throw new StandardRuntimeException(String.format("PROPERTY is NOT_FOUND. [baseName=%s]", baseName)); }
From source file:pcgen.system.ConfigurationSettings.java
private ConfigurationSettings(String configFileName) { super(configFileName); //Initialize defaults setProperty(USER_LANGUAGE, SystemUtils.USER_LANGUAGE); setProperty(USER_COUNTRY, SystemUtils.USER_COUNTRY); setProperty(THEME_PACK_DIR, "@lib/lnf/themes".replace('/', File.separatorChar)); setProperty(SYSTEMS_DIR, "@system"); setProperty(OUTPUT_SHEETS_DIR, "@outputsheets"); setProperty(PLUGINS_DIR, "@plugins"); setProperty(PREVIEW_DIR, "@preview"); setProperty(DOCS_DIR, "@docs"); setProperty(PCC_FILES_DIR, "@data"); }