Example usage for java.util Locale toString

List of usage examples for java.util Locale toString

Introduction

In this page you can find the example usage for java.util Locale toString.

Prototype

@Override
public final String toString() 

Source Link

Document

Returns a string representation of this Locale object, consisting of language, country, variant, script, and extensions as below:
language + "_" + country + "_" + (variant + "_#" | "#") + script + "_" + extensions
Language is always lower case, country is always upper case, script is always title case, and extensions are always lower case.

Usage

From source file:org.appd.login.V_Login.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    et_User = (EditText) getActivity().findViewById(R.id.et_User);
    et_Pass = (EditText) getActivity().findViewById(R.id.et_Pass);
    ch_SavePass = (CheckBox) getActivity().findViewById(R.id.ch_SavePass);
    ch_AutomaticVisitClosing = (CheckBox) getActivity().findViewById(R.id.ch_AutomaticVisitClosing);
    sp_Language = (Cust_Spinner) getActivity().findViewById(R.id.sp_Language);

    ArrayList<DisplaySpinner> data = new ArrayList<DisplaySpinner>();
    for (Locale loc : Locale.getAvailableLocales()) {
        data.add(new DisplaySpinner(0, loc.getDisplayName(), loc.toString()));
    }//from  ww w .j  ava 2  s.  c o m
    sp_Language.load(data);

}

From source file:com.wisemapping.ncontroller.MindmapController.java

@RequestMapping(value = "maps/{id}/embed")
public ModelAndView showEmbeddedPage(@PathVariable int id, @RequestParam(required = false) Float zoom) {
    ModelAndView view;//from w  w w  .j  a  v a2  s  . c o  m
    final MindMapBean mindmap = findMindmapBean(id);
    view = new ModelAndView("mindmapEmbedded", "mindmap", mindmap);
    view.addObject("zoom", zoom == null ? 1 : zoom);
    final Locale locale = LocaleContextHolder.getLocale();
    view.addObject("locale", locale.toString().toLowerCase());
    return view;
}

From source file:org.jboss.dashboard.LocaleManager.java

/**
 * Get a Locale by its id./*from  ww  w.  j  a v a2  s .c o  m*/
 *
 * @return a Locale whose toString() equals given localeId, or null if it doesn't exist
 */
public Locale getLocaleById(String localeId) {
    Locale[] allLocales = getAllLocales();
    for (int i = 0; i < allLocales.length; i++) {
        Locale locale = allLocales[i];
        if (locale.toString().equals(localeId))
            return locale;
    }
    return null;
}

From source file:com.wisemapping.ncontroller.MindmapController.java

@RequestMapping(value = "maps/{id}/print")
public String showPrintPage(@PathVariable int id, @NotNull Model model) {
    final MindMapBean mindmap = findMindmapBean(id);
    model.addAttribute("principal", Utils.getUser());
    model.addAttribute("mindmap", mindmap);
    final Locale locale = LocaleContextHolder.getLocale();
    model.addAttribute("locale", locale.toString().toLowerCase());
    return "mindmapPrint";
}

From source file:com.bstek.dorado.core.resource.DefaultResourceManager.java

protected Resource findResource(Locale locale) throws Exception {
    Resource resource = null;//  w  w  w. ja va2  s . com

    String path = StringUtils.replace(bundleName, ".", "/");
    if (locale != null) {
        String localeSuffix = '.' + locale.toString();
        resource = ResourceUtils.getResource(path + localeSuffix + RESOURCE_FILE_SUFFIX);
        if (resource != null && resource.exists()) {
            return resource;
        }
    }

    resource = ResourceUtils.getResource(path + RESOURCE_FILE_SUFFIX);
    if (resource != null && resource.exists()) {
        return resource;
    }

    return null;
}

From source file:org.jboss.dashboard.LocaleManager.java

protected String[] localeToString(Locale[] locales) {
    List langs = new ArrayList();
    for (int i = 0; i < locales.length; i++) {
        Locale locale = locales[i];
        String s = locale.toString();
        langs.add(s);//from  ww w . ja v a2 s  . c o m
    }
    return (String[]) langs.toArray(new String[langs.size()]);
}

From source file:org.glucosio.android.activity.HelloActivity.java

private void initLanguageSpinner(final LocaleHelper localeHelper) {
    localesWithTranslation = localeHelper.getLocalesWithTranslation(getResources());

    List<String> displayLanguages = new ArrayList<>(localesWithTranslation.size());
    for (String language : localesWithTranslation) {
        if (language.length() > 0) {
            displayLanguages.add(localeHelper.getDisplayLanguage(language));
        }//  w  w w . j a  v a2  s  .  c  o  m
    }

    languageSpinner.setItemsArray(displayLanguages);

    final Locale deviceLocale = localeHelper.getDeviceLocale();
    String displayLanguage = localeHelper.getDisplayLanguage(deviceLocale.toString());

    setSelection(displayLanguage, languageSpinner);
}

From source file:com.wisemapping.ncontroller.MindmapController.java

@RequestMapping(value = "maps/{id}/edit", method = RequestMethod.GET)
public String showMindmapEditorPage(@PathVariable int id, @NotNull Model model) {
    final MindMapBean mindmapBean = findMindmapBean(id);
    final Mindmap mindmap = mindmapBean.getDelegated();

    model.addAttribute("mindmap", mindmapBean);

    // Configure default locale for the editor ...
    final Locale locale = LocaleContextHolder.getLocale();
    model.addAttribute("locale", locale.toString().toLowerCase());
    final User collaborator = Utils.getUser();
    model.addAttribute("principal", collaborator);
    model.addAttribute("readOnlyMode", !mindmap.hasPermissions(collaborator, CollaborationRole.EDITOR));
    return "mindmapEditor";
}

From source file:com.properned.model.MultiLanguageProperties.java

public void deleteLocale(Locale locale) {
    logger.info("Remove locale " + locale.toString());

    PropertiesFile propertiesFile = mapPropertiesFileByLocale.get(locale);
    if (propertiesFile != null) {
        propertiesFile.delete();//from ww w. j a v a 2 s.  com
    }

    mapPropertiesByLocale.remove(locale);
    mapPropertiesFileByLocale.remove(locale);
}

From source file:org.betaconceptframework.astroboa.console.jsf.ContentObjectViewAsTree.java

public String getLocalizedLabelForLocale(String localeName) {
    try {/*from www  .  ja  v a2 s  .  c o  m*/
        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;
    }
}