List of usage examples for java.util Locale getDisplayName
public final String getDisplayName()
From source file:com.example.locale.MainActivity.java
private void showDefaultLocale() { Locale locale = Locale.getDefault(); setTitle(locale.getDisplayName()); BitmapDrawable d = (BitmapDrawable) ImageUtil.getFlagIcon(this, locale.getCountry()); if (d != null) { final Bitmap bitmap = d.getBitmap(); mPaletteTask = new Palette.Builder(bitmap).generate(new Palette.PaletteAsyncListener() { @Override//w ww .jav a 2s. c om public void onGenerated(Palette palette) { mPaletteTask = null; int color = palette.getDarkVibrantColor(0); mToolbar.setBackgroundColor(color); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(getDarkerColor(color)); } } }); } }
From source file:edu.ku.brc.af.core.SchemaI18NService.java
/** * Return a locale by name./* w w w . j a v a2 s . c o m*/ * @param displayName the name in the menu's display * @return the locale or null */ public Locale getLocaleByName(final String displayName) { // Need to use binarySearch for (Locale locale : locales) { if (locale.getDisplayName().equals(displayName)) { return locale; } } return null; }
From source file:org.betaconceptframework.astroboa.console.jsf.ContentObjectViewAsTree.java
public String getLocalizedLabelForLocale(String localeName) { try {/* w w w.ja v a 2 s . c om*/ if (StringUtils.isNotBlank(localeName)) { //In case locale is the same with localeSelector if (localeName.equals(localeSelector.getLocaleString())) return localeSelector.getLocale().getDisplayName(); else { //Try to find its name from supported locales Iterator<Locale> locales = FacesContext.getCurrentInstance().getApplication() .getSupportedLocales(); while (locales.hasNext()) { Locale locale = locales.next(); if (localeName.equals(locale.toString())) return locale.getDisplayName(); } } } return localeName; } catch (Exception e) { return localeName; } }
From source file:net.bible.android.BibleApplication.java
@Override public void onCreate() { super.onCreate(); // save to a singleton to allow easy access from anywhere singleton = this; Log.i(TAG, "OS:" + System.getProperty("os.name") + " ver " + System.getProperty("os.version")); Log.i(TAG, "Java:" + System.getProperty("java.vendor") + " ver " + System.getProperty("java.version")); Log.i(TAG, "Java home:" + System.getProperty("java.home")); Log.i(TAG,/*from w w w.j a va 2 s . c o m*/ "User dir:" + System.getProperty("user.dir") + " Timezone:" + System.getProperty("user.timezone")); // fix for null context class loader (http://code.google.com/p/android/issues/detail?id=5697) // this affected jsword dynamic classloading Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); installJSwordErrorReportListener(); // some changes may be required for different versions upgradePersistentData(); // initialise link to Android progress control display in Notification bar ProgressNotificationManager.getInstance().initialise(); allowLocaleOverride(); Locale locale = Locale.getDefault(); Log.i(TAG, "Locale language:" + locale.getLanguage() + " Variant:" + locale.getDisplayName()); screenTimeoutSettings.overrideScreenTimeout(); // various initialisations required every time at app startup Initialisation.getInstance().initialiseEventually(); }
From source file:org.eclipse.jubula.client.core.model.TestResult.java
/** * {@inheritDoc}/* w ww .j a va 2 s . c o m*/ */ public String getTestLanguage() { Locale testLocale = TestExecution.getInstance().getLocale(); return testLocale != null ? testLocale.getDisplayName() : StringUtils.EMPTY; }
From source file:de.kaiserpfalzEdv.commons.HandleI18NImpl.java
@Override public void setLocale(@NotNull final Locale locale) { checkArgument(locale != null, "locale must be not null"); //noinspection ConstantConditions if (!locale.equals(this.locale)) { LOG.trace("Setting locale to '{}'.", locale.getDisplayName()); this.locale = locale; resetMessageBundle();//w w w . ja v a 2s. c o m } }
From source file:edu.ku.brc.specify.tools.schemalocale.LocalizerBasePanel.java
/** * @param displayName//from ww w . j a va2 s .c om * @return */ protected Locale getLocaleByName(final String displayName) { for (Locale locale : SchemaI18NService.getInstance().getLocales()) { if (locale.getDisplayName().equals(displayName)) { return locale; } } return null; }
From source file:com.aurel.track.prop.LoginBL.java
/** * This method controls entire login procedure. * * @param isInTestMode// ww w . j ava2s. c o m * @param isMobileApplication * @param username * @param usingContainerBasedAuthentication * @param password * @param forwardUrl * @param springAuthenticated * @param mobileApplicationVersionNo * @param locale * @return */ public static String restLogin(String username, String password, Locale locale) { Map envResult = null; ArrayList<LabelValueBean> errors = new ArrayList<LabelValueBean>(); TPersonBean user = userIdentifiedByToken(username, password); if (user == null) { HttpServletRequest request = ServletActionContext.getRequest(); if (locale == null) { locale = Locale.getDefault(); LOGGER.debug("Requested locale is null. Using default:" + locale.getDisplayName()); } else { LOGGER.debug("Requested locale " + locale.getDisplayName()); } envResult = LoginBL.setEnvironment(username, password, null, request, ActionContext.getContext().getSession(), false, false, false); user = (TPersonBean) envResult.get("user"); String tokenPasswd = DigestUtils.md5Hex(Long.toString(new Date().getTime())).substring(0, 7); if (user != null) { user.setTokenPasswd(tokenPasswd); } Integer mappingEnum = (Integer) envResult.get("mappingEnum"); errors = (ArrayList<LabelValueBean>) envResult.get("errors"); } Boolean ready = (Boolean) ServletActionContext.getServletContext().getAttribute(ApplicationStarter.READY); if (ready == null || ready.booleanValue() == false) { errors.add(new LabelValueBean("notReady", "Server not ready")); } StringBuilder sb = new StringBuilder("{"); if (user == null || (errors != null && errors.size() > 0)) { JSONUtility.appendBooleanValue(sb, JSONUtility.JSON_FIELDS.SUCCESS, false); sb.append(DATABRACE); JSONUtility.appendLabelValueBeanList(sb, "errors", errors); } else { user.setTokenExpDate(new Date(new Date().getTime() + 120 * 60 * 1000)); DAOFactory.getFactory().getPersonDAO().save(user); JSONUtility.appendBooleanValue(sb, JSONUtility.JSON_FIELDS.SUCCESS, true); sb.append(DATABRACE); JSONUtility.appendStringValue(sb, "token", user.getTokenPasswd()); } sb.append("}}"); return writeJSONResponse(sb); // The redirect is done by the client // JavaScript }
From source file:org.omegat.core.spellchecker.DictionaryManager.java
/** * returns a list of full names of dictionaries from a dictionary code list *///from w w w. j av a 2 s .c om public List<String> getDictionaryNameList(List<String> aList) { List<String> result = new ArrayList<String>(); for (String dic : aList) { String[] parts = dic.split("_"); Locale locale; if (parts.length == 1) { locale = new Locale(parts[0]); } else { locale = new Locale(parts[0], parts[1]); } result.add(dic + " - " + locale.getDisplayName()); } return result; }
From source file:com.properned.application.LocaleListCell.java
@Override protected void updateItem(Locale locale, boolean empty) { super.updateItem(locale, empty); setGraphic(null);// w w w. ja v a 2 s. c o m setText(null); if (locale != null) { String localeToString = locale.toString(); if (localeToString.isEmpty()) { localeToString = MessageReader.getInstance().getMessage("locale.default"); } if (StringUtils.isNotEmpty(locale.getDisplayName())) { localeToString += " (" + locale.getDisplayName() + ")"; } setText(localeToString); MenuItem deleteMenu = getDeleteMenu(locale); this.setContextMenu(new ContextMenu(deleteMenu)); } }