List of usage examples for org.apache.commons.lang LocaleUtils toLocale
public static Locale toLocale(String str)
Converts a String to a Locale.
This method takes the string format of a locale and creates the locale object from it.
LocaleUtils.toLocale("en") = new Locale("en", "") LocaleUtils.toLocale("en_GB") = new Locale("en", "GB") LocaleUtils.toLocale("en_GB_xxx") = new Locale("en", "GB", "xxx") (#)
(#) The behaviour of the JDK variant constructor changed between JDK1.3 and JDK1.4.
From source file:org.geomajas.plugin.printing.component.ComponentUtilTest.java
@Test public void testGetResourceBundleUnknown() throws Exception { String locale = "xyz"; String[] defaultLocaleArray = new String[] { "en", "nl" }; for (String defaultLocale : defaultLocaleArray) { Locale.setDefault(LocaleUtils.toLocale(defaultLocale)); ResourceBundle resourceBundle = ComponentUtil.getCurrentResourceBundle(locale); Assert.assertEquals(defaultLocale.toLowerCase(), resourceBundle.getLocale().toString().toLowerCase()); }/*from w w w.j a va 2s. com*/ }
From source file:org.hippoecm.repository.impl.NodeDecorator.java
private Localized getLocalizedForLanguage(final String language) throws IllegalArgumentException { if (StringUtils.isBlank(language)) { return Localized.getInstance(); }//from w w w . j a v a 2 s. c o m final Locale locale = LocaleUtils.toLocale(language); return Localized.getInstance(locale); }
From source file:org.hoteia.qalingo.core.rest.controller.ReferentialDataRestService.java
@GET @Path("title/list/{locale}") @Produces(MediaType.APPLICATION_JSON)//from w w w .j ava2 s . c o m public List<ReferentialDataPojo> getTitlesByLocale(@PathParam("locale") final String locale) { return referentialDataService.getTitlesByLocale(LocaleUtils.toLocale(locale)); }
From source file:org.hoteia.qalingo.core.rest.controller.ReferentialDataRestService.java
@GET @Path("title/{code}/{locale}") @Produces(MediaType.APPLICATION_JSON)//from w ww . ja v a 2 s .co m public ReferentialDataPojo getTitleByLocale(@PathParam("code") final String code, @PathParam("locale") final String locale) { return referentialDataService.getTitleByLocale(code, LocaleUtils.toLocale(locale)); }
From source file:org.hoteia.qalingo.core.rest.controller.ReferentialDataRestService.java
@GET @Path("state/list/{locale}") @Produces(MediaType.APPLICATION_JSON)//from w ww. j av a 2 s.c om public List<ReferentialDataPojo> getStatesByLocale(@PathParam("locale") final String locale) { return referentialDataService.getStatesByLocale(LocaleUtils.toLocale(locale)); }
From source file:org.hoteia.qalingo.core.rest.controller.ReferentialDataRestService.java
@GET @Path("state/{code}/{locale}") @Produces(MediaType.APPLICATION_JSON)// w w w . j a va2 s .c o m public ReferentialDataPojo getStateByLocale(@PathParam("code") final String code, @PathParam("locale") final String locale) { return referentialDataService.getStateByLocale(code, LocaleUtils.toLocale(locale)); }
From source file:org.hoteia.qalingo.core.rest.controller.ReferentialDataRestService.java
@GET @Path("area/list/{locale}") @Produces(MediaType.APPLICATION_JSON)/*from w w w. jav a 2 s .c o m*/ public List<ReferentialDataPojo> getAreasByLocale(@PathParam("locale") final String locale) { return referentialDataService.getAreasByLocale(LocaleUtils.toLocale(locale)); }
From source file:org.hoteia.qalingo.core.rest.controller.ReferentialDataRestService.java
@GET @Path("area/{code}/{locale}") @Produces(MediaType.APPLICATION_JSON)//w w w. j a v a 2 s. co m public ReferentialDataPojo getAreaByLocale(@PathParam("code") final String code, @PathParam("locale") final String locale) { return referentialDataService.getAreaByLocale(code, LocaleUtils.toLocale(locale)); }
From source file:org.hoteia.qalingo.core.rest.controller.ReferentialDataRestService.java
@GET @Path("country/list/{locale}") @Produces(MediaType.APPLICATION_JSON)/*from w w w . j ava 2 s . c o m*/ public List<ReferentialDataPojo> getCountrysByLocale(@PathParam("locale") final String locale) { return referentialDataService.getCountriesByLocale(LocaleUtils.toLocale(locale)); }
From source file:org.hoteia.qalingo.core.rest.controller.ReferentialDataRestService.java
@GET @Path("country/{code}/{locale}") @Produces(MediaType.APPLICATION_JSON)//from ww w .j av a 2 s . com public ReferentialDataPojo getCountryByLocale(@PathParam("code") final String code, @PathParam("locale") final String locale) { return referentialDataService.getCountryByLocale(code, LocaleUtils.toLocale(locale)); }