List of usage examples for java.util Locale Locale
public Locale(String language)
From source file:jease.cms.web.servlet.JeaseServletListener.java
protected void initLocale(ServletContext context) { String localeCode = context.getInitParameter(Names.JEASE_DEFAULT_LOCALE); if (StringUtils.isNotBlank(localeCode)) { Locale locale = new Locale(localeCode); I18N.load(locale);//w w w .ja v a 2 s. c o m context.setAttribute("org.zkoss.web.preferred.locale", locale); } }
From source file:com.netsteadfast.greenstep.base.interceptor.LocaleLangInterceptor.java
@Override public String intercept(ActionInvocation actionInvocation) throws Exception { String lang = UserAccountHttpSessionSupport.getLang(ServletActionContext.getContext()); if (!StringUtils.isBlank(lang)) { Locale locale = new Locale(lang); ActionContext.getContext().setLocale(locale); //logger.info( "SET-Locale: " + lang ); }/*from w w w . j av a 2 s. c o m*/ return actionInvocation.invoke(); }
From source file:ru.gelin.android.weather.google.GoogleWeatherSourceTest.java
public void ignoretestQueryRu() throws Exception { WeatherSource source = new GoogleWeatherSource(); Location location = new SimpleLocation("?"); Weather weather = source.query(location, new Locale("ru")); assertTrue(weather.getLocation().getText().contains("Omsk")); assertEquals(4, weather.getConditions().size()); System.out.println(weather.getConditions().get(0).getHumidityText()); assertTrue(weather.getConditions().get(0).getHumidityText().startsWith("?")); System.out.println(weather.getConditions().get(0).getWindText()); assertTrue(weather.getConditions().get(0).getWindText().startsWith("")); }
From source file:almira.sample.web.AbstractBasePage.java
/** * Constructor./*from www . j av a2 s . c om*/ */ AbstractBasePage() { super(); // http://apache-wicket.1842946.n4.nabble.com/wicket-message-in-the-title-td1843627.html add(new Label("pageTitle", new ResourceModel("catapult.title"))); add(new BookmarkablePageLink<Void>("homeLink", IndexPage.class)); add(new BookmarkablePageLink<Void>("adminLink", AdminPage.class)); add(new LocaleDropDownPanel("localeSelectPanel", Arrays.asList(new Locale("es"), new Locale("de"), new Locale("en"), new Locale("fr"), new Locale("it")))); add(new Label("version", ((MainApplication) getApplication()).getVersion())); add(new Label("session", new PropertyModel<String>(this, "session.id"))); add(new SearchPanel("searchPanel")); add(new Label("footertext", footerTextService.getText())); // Page 87, Wicket in Action add(new Label("clock", new Model<String>() { @Override public String getObject() { final SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy | HH:mm:ss.mmm", getSession().getLocale()); return dateFormat.format(new Date()); } })); }
From source file:io.selendroid.standalone.android.impl.DefaultAndroidEmulatorTests.java
@Ignore("Fail. Requires emulator to exist on the system running the test.") @Test//from w w w.jav a2s. c om public void testShouldBeAbleToStartEmulator() throws Exception { AndroidEmulator emulator = new DefaultAndroidEmulator("l10n", "X86", new Dimension(320, 480), "16", "Nexus 5", new File(FileUtils.getUserDirectory(), ".android" + File.separator + "avd" + File.separator + "l10n.avd"), "google"); Assert.assertTrue("expecting emulators exists: ", emulator.isEmulatorAlreadyExistent()); Assert.assertFalse("expecting emulator is not yet started: ", emulator.isEmulatorStarted()); emulator.start(new Locale("en_GB"), 5554, null); Assert.assertTrue(emulator.isEmulatorStarted()); emulator.stop(); Assert.assertFalse(emulator.isEmulatorStarted()); }
From source file:dk.nsi.haiba.lprimporter.message.MessageResolver.java
public String getMessage(String name, Object... args) { return messageSource.getMessage(name, args, new Locale("DA_DK")); }
From source file:fi.helsinki.opintoni.web.rest.privateapi.NewsResourceTest.java
@Test public void thatStudentNewsAreReturned() throws Exception { flammaServer.expectStudentNews();/*w ww . jav a 2 s. com*/ mockMvc.perform(get("/api/private/v1/news/student").with(securityContext(studentSecurityContext())) .characterEncoding("UTF-8").contentType(MediaType.APPLICATION_JSON).locale(new Locale("fi")) .accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk()) .andExpect(content().contentType(WebConstants.APPLICATION_JSON_UTF8)) .andExpect(jsonPath("$").isArray()).andExpect(jsonPath("$", hasSize(2))) .andExpect(jsonPath("$[0].title").value("Ajatusten vaihtoa ja vertaistukea verkossa")) .andExpect(jsonPath("$[0].url").value("https://flamma.helsinki.fi/portal/home/sisalto1")) .andExpect(jsonPath("$[0].content").value("Content")) .andExpect(jsonPath("$[1].title").value("Reflekta palkittiin parhaana opiskelijakilpailussa")) .andExpect(jsonPath("$[1].url").value("https://flamma.helsinki.fi/portal/home/sisalto2")) .andExpect(jsonPath("$[1].content").value("Content")); }
From source file:dk.nsi.haiba.epimibaimporter.message.MessageResolver.java
public String getMessage(String name, Object[] args) { return messageSource.getMessage(name, args, new Locale("DA_DK")); }
From source file:annis.libgui.MatchedNodeColors.java
private String twoDigitHex(int i) { String result = Integer.toHexString(i).toLowerCase(new Locale("en")); if (result.length() > 2) { result = result.substring(0, 2); } else if (result.length() < 2) { result = StringUtils.leftPad(result, 2, '0'); }/*from w w w .j a v a2s .co m*/ return result; }
From source file:org.osiam.addons.selfadministration.util.RegistrationHelper.java
public static Locale getLocale(String userLocale) { if (!Strings.isNullOrEmpty(userLocale)) { Locale locale = new Locale(userLocale); if (!locale.toLanguageTag().equals("und")) { // Undetermined return locale; }//w w w. j av a 2s . c om } return LocaleContextHolder.getLocale(); }