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:com.adkdevelopment.yalantisinternship.MainFragment.java

/**
 * Fetch data from the Internet with Retrofit Client
 * Considering the fact that data is also refreshed on swipe down this method is necessary
 *//* w w  w .  ja  v a2s.c  o m*/
private void refresh() {

    Locale locale = getResources().getConfiguration().locale;

    if (locale.toString().contains("UA")) {
        App.getApiManager().getService().getUaData().enqueue(callback);
    } else {
        App.getApiManager().getService().getData().enqueue(callback);
    }
}

From source file:org.jasig.portlet.cms.mvc.portlet.SearchContentController.java

public String getTextContent(PortletRequest request) {
    final Locale locale = request.getLocale();
    final String content = this.contentDao.getContent(request, locale.toString());
    return this.stringCleaningService.getTextContent(content);
}

From source file:com.fredhopper.connector.index.populator.CategoryPopulatorTest.java

private void mockCategory(final CategoryModel category, final int id) {
    when(category.getCode()).thenReturn("cat" + id);

    for (final Locale loc : localesEnDe) {
        when(category.getName(loc)).thenReturn("name" + id + loc.toString());
    }/*from w  ww. j ava2s  .c om*/

}

From source file:com.fredhopper.connector.query.converters.SearchQueryPageableConverter.java

@Override
protected Query createTarget() {
    final Locale locale = commerceCommonI18NService
            .getLocaleForLanguage(commerceCommonI18NService.getCurrentLanguage());
    return new Query(universe, locale.toString());
}

From source file:org.jia.ptrack.web.Visit.java

public List getSupportedtLocaleItems() {
    if (localeItems == null) {
        localeItems = new ArrayList();
        Application app = FacesContext.getCurrentInstance().getApplication();
        for (Iterator i = app.getSupportedLocales(); i.hasNext();) {
            Locale locale = (Locale) i.next();
            SelectItem item = new SelectItem(locale.toString(), locale.getDisplayName());
            localeItems.add(item);/*from   ww w  .  j  ava 2s .  com*/
        }
        if (localeItems.size() == 0) {
            Locale defaultLocale = app.getDefaultLocale();
            localeItems.add(new SelectItem(defaultLocale.toString(), defaultLocale.getDisplayName()));
        }
    }
    return localeItems;
}

From source file:de.cosmocode.palava.services.mail.VelocityMailService.java

@Override
public MimeMessage send(TemplateDescriptor descriptor, Locale locale, Map<String, ?> params) throws Exception {
    return send(descriptor, locale == null ? null : locale.toString(), params);
}

From source file:edu.cornell.mannlib.vitro.webapp.i18n.selection.LocaleSelectionDataGetter.java

private Map<String, Object> buildLocaleMap(Locale locale, Locale currentLocale) throws FileNotFoundException {
    Map<String, Object> map = new HashMap<>();
    map.put("code", locale.toString());
    map.put("label", locale.getDisplayName(currentLocale));
    map.put("imageUrl", LocaleSelectorUtilities.getImageUrl(vreq, locale));
    map.put("selected", currentLocale.equals(locale));
    return map;//  w ww  .j a  v a 2 s  .co m
}

From source file:facebook4j.TargetingParameter.java

public void setLocales(Set<Locale> locales) {
    this.locales = new LinkedHashSet<String>();
    for (Locale locale : locales) {
        this.locales.add(locale.toString());
    }//from   w w  w  .  jav a 2s.c o  m
}

From source file:facebook4j.TargetingParameter.java

public TargetingParameter locales(Collection<Locale> locales) {
    if (this.locales == null) {
        this.locales = new LinkedHashSet<String>();
    }//from  w w w .  j  a  v a2s .  co  m
    for (Locale locale : locales) {
        this.locales.add(locale.toString());
    }
    return this;
}

From source file:com.rest.EmailSender.java

public void sendReserPasswordEmail(String resetPasswordToken, String requestBaseUrl) {
    Locale locale = LocaleContextHolder.getLocale();
    String resetPasswordTemplate = "";
    switch (locale.toString()) {
    case "fr":
        resetPasswordTemplate = "resetPasswordTemplate_fr";
        break;//from w  w  w . j  a v  a 2 s.c o  m
    default:
        resetPasswordTemplate = "resetPasswordTemplate_en";
        break;
    }

    Context ctx = new Context();
    ctx.setVariable("resetPasswordToken", resetPasswordToken.toString());
    ctx.setVariable("requestBaseUrl", requestBaseUrl.toString());

    String emailText = thymeleaf.process(resetPasswordTemplate, ctx);

    try {
        sendMessage(bundleMessageReader.getMessage("ResetPasswordEmailHeader"), emailText);
    } catch (MessagingException e) {
        e.printStackTrace();
    }
}