List of usage examples for java.util Locale ENGLISH
Locale ENGLISH
To view the source code for java.util Locale ENGLISH.
Click Source Link
From source file:com.xpfriend.fixture.cast.temp.DynaBeanFactory.java
static Class<?> toClass(String typeName) throws ClassNotFoundException { if (typeName == null) { return String.class; }//ww w . j av a 2 s.c o m Class<?> cls = classMap.get(typeName.toLowerCase(Locale.ENGLISH)); if (cls != null) { return cls; } return Class.forName(typeName); }
From source file:ru.mystamps.web.support.spring.security.SessionLocaleResolverAwareFilter.java
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try {//from w w w .j av a2 s . co m HttpServletRequest req = (HttpServletRequest) request; LOG.debug("Handling request {} {}", req.getMethod(), req.getRequestURI()); Locale locale = (Locale) WebUtils.getSessionAttribute((HttpServletRequest) request, SessionLocaleResolver.LOCALE_SESSION_ATTRIBUTE_NAME); if (locale == null) { locale = Locale.ENGLISH; LOG.debug("Locale reset to 'en' (default)"); } else { LOG.debug("Locale reset to '{}' (from session)", locale); } LocaleContextHolder.setLocale(locale); } catch (RuntimeException ex) { // NOPMD: AvoidCatchingGenericException LOG.warn("Couldn't handle request: {}", ex); } finally { chain.doFilter(request, response); } }
From source file:at.ac.univie.isc.asio.database.MysqlSchemaService.java
private org.jooq.Schema findActiveSchema(final DSLContext jooq, final Id target) throws SQLException { final String activeSchemaName = target.asString(); if (INTERNAL_SCHEMA.contains(activeSchemaName.toLowerCase(Locale.ENGLISH))) { throw new Id.NotFound(target); }/* www .j a v a 2 s. co m*/ final org.jooq.Schema schema = Iterables.getOnlyElement(jooq.meta().getCatalogs()) .getSchema(activeSchemaName); if (schema == null) { throw new Id.NotFound(target); } return schema; }
From source file:com.salesmanager.core.util.LabelUtil.java
private void getLocale(String lang) { if (StringUtils.isBlank(lang)) { lang = LanguageUtil.getDefaultLanguage(); }// w ww. ja va2 s . c om if (lang.equals("en")) { setLocale(Locale.ENGLISH); } else if (lang.equals("fr")) { setLocale(Locale.FRENCH); } else { setLocale(new Locale(lang)); } }
From source file:com.dmsl.anyplace.tasks.AnyplaceSuggestionsTask.java
public static boolean matchQueryPoi(String query, String poi) { query = query.toLowerCase(Locale.ENGLISH); poi = poi.toLowerCase(Locale.ENGLISH); String[] segs = poi.split(" "); for (String s : segs) { if (s.contains(query)) { return true; }/*from w w w .j av a 2 s. c o m*/ } return false; }
From source file:de.awtools.lang.TranslatorTest.java
@Test public void testTransformationEnglish() { TranslatorFactory tf = new TranslatorFactory(); translator = tf.getTranslator("de.awtools.lang.TestTranslator", Locale.ENGLISH); assertThat(translator.getString("test.error.fatal")).isEqualTo("Fatal error. Applicatin will be aborted!"); assertThat(translator.getString("test.text.1", "Andre")).isEqualTo("Andre is ok."); assertThat(translator.getString("test.text.1", "Lars")).isEqualTo("Lars is ok."); assertThat(translator.getString("test.text.2", "Andre", "der Lars")) .isEqualTo("The Andre and der Lars are silly."); }
From source file:net.sf.jabref.logic.journals.JournalAbbreviationRepository.java
/** * Attempts to get the abbreviated name of the journal given. May contain dots. * * @param journalName The journal name to abbreviate. * @return The abbreviated name/*from w w w .j av a 2 s .c om*/ */ public Optional<Abbreviation> getAbbreviation(String journalName) { String nameKey = Objects.requireNonNull(journalName).toLowerCase(Locale.ENGLISH).trim(); if (fullNameLowerCase2Abbreviation.containsKey(nameKey)) { return Optional.of(fullNameLowerCase2Abbreviation.get(nameKey)); } else if (isoLowerCase2Abbreviation.containsKey(nameKey)) { return Optional.of(isoLowerCase2Abbreviation.get(nameKey)); } else if (medlineLowerCase2Abbreviation.containsKey(nameKey)) { return Optional.of(medlineLowerCase2Abbreviation.get(nameKey)); } else { return Optional.empty(); } }
From source file:com.timesoft.kaitoo.ws.hibernate.AbstractPojo.java
public String toValueString() { PropertyDescriptor[] pd = PropertyUtils.getPropertyDescriptors(this); StringBuffer buffer = new StringBuffer(); SimpleDateFormat simple = new SimpleDateFormat("dd-MM-yyyy", Locale.ENGLISH); if (((List) callStack.get()).contains(this)) { buffer.append("Cyclic Reference!!!"); } else {/*www. ja va2s .c om*/ ((List) callStack.get()).add(this); for (int index = 0; index < pd.length; ++index) { if ((null != PropertyUtils.getReadMethod(pd[index])) && (pd[index].getPropertyType() != Class.class)) { if (buffer.length() > 0) { buffer.append(", "); } String prop_name = pd[index].getName(); try { if (null == PropertyUtils.getProperty(this, prop_name)) { buffer.append("\" \""); } else { if (pd[index].getPropertyType() == Calendar.class) { buffer.append("\"" + simple.format( ((Calendar) PropertyUtils.getProperty(this, prop_name)).getTime()) + "\""); } else if (pd[index].getPropertyType() == Date.class) { buffer.append( "\"" + simple.format(PropertyUtils.getProperty(this, prop_name) + "\"")); } else { buffer.append("\"" + PropertyUtils.getProperty(this, prop_name) + "\""); } } } catch (Exception e) { buffer.append(e.getMessage()); } } } ((List) callStack.get()).remove(this); } buffer.append(" \n"); return buffer.toString(); }
From source file:net.firejack.platform.core.validation.NotNullProcessor.java
@Override public List<Constraint> generate(Method readMethod, String property, Map<String, String> params) { List<Constraint> constraints = null; Annotation annotation = readMethod.getAnnotation(NotNull.class); if (annotation != null) { NotNull notNull = (NotNull) annotation; Constraint constraint = new Constraint(notNull.annotationType().getSimpleName()); String errorMessage = MessageResolver.messageFormatting(notNull.msgKey(), Locale.ENGLISH, property); //TODO need to set real locale constraint.setErrorMessage(errorMessage); constraints = new ArrayList<Constraint>(); constraints.add(constraint);/*w ww .j a v a 2 s.c o m*/ } return constraints; }