Returns a localization value object describing the defaults specified in the @Message
annotations of the methods on the given i18n interface. The locale used is the system
default.
554662
public static Localization defaultLocalizationFor(Class<?> iface) {
    Map<String, String> defaultMessages = Maps.newHashMap();

    for (Method method : iface.getMethods()) {
      Message msg = method.getAnnotation(Message.class);
      if (null != msg) {
        defaultMessages.put(method.getName(), msg.message());
      }
    }

    return new Localization(iface, Locale.getDefault(), defaultMessages);
  }
472721
public String getMessage(final MSLocale locale, final String key) {
        if(locale == null) {
            return loadResource(null).getMessage(key);

        } else {
            return loadResource(locale.getLocale()).getMessage(key);
        }
    }
489026
public Locale getLocale()
    {
        String strLanguage = this.getProperty(Params.LANGUAGE);
        if ((strLanguage != null) && (strLanguage.length() > 0))
        {
            Locale locale = Locale.getDefault();
            if (!strLanguage.equalsIgnoreCase(locale.getLanguage()))
                locale = new Locale(strLanguage, "");
            if (locale != null)
            {
                try {
                    Locale.setDefault(locale);
                } catch (java.security.AccessControlException ex) {
                    Util.getLogger().warning("Can't change locale");   // Ignore and continue
                }
            }
        }
        return Locale.getDefault();
    }
826731
public String getMessage(String key, Locale locale)
	{
		if (null == locale)
		{
			return getMessage(key);
		}
		return CollectionTools.getString(getResourceBundle(locale), key, getBehaviourOnMissingMessage().getValueOnMissingMessage(key));
	}
740250
protected String getMessageInternal(Locale locale, String code, Object[] args) {
		if(code == null) {
			return null;
		}

		if(locale == null) {
			locale = I18nUtils.getLocale();
		}

		final MessageFormat messageFormat = resolveMessageFormat(locale, code);
		if(messageFormat != null) {
			synchronized(messageFormat) {
				return messageFormat.format(args);
			}
		}

		return null;
	}
891245
public Locale getLocale() {
        UI currentUI = UI.getCurrent();
        Locale locale = currentUI == null ? null : currentUI.getLocale();
        if (locale == null) {
            locale = Locale.getDefault();
        }
        return locale;
    }
1169605
@Deprecated
    public static Locale getLocale() {
        Locale locale = null;
        FacesContext facesContext = FacesContext.getCurrentInstance();

        if (facesContext != null && facesContext.getViewRoot() != null) {
            locale = facesContext.getViewRoot().getLocale();

            if (locale == null) {
                locale = Locale.getDefault();
            }
        }
        else {
            locale = Locale.getDefault();
        }
        return locale;
    }
1230757
public Locale getMainTranslationLocale(Locale defaultValue) {

        Map<String, String> params = getParameters();
        String value = params.get(PARAM_MAIN_LOCALE);
        if (!CmsStringUtil.isEmpty(value)) {
            return CmsLocaleManager.getLocale(value);
        } else {
            return defaultValue;
        }
    }
207635
@Test
    public void get_missing_default_translation() {
        KeySearchCriteria criteria = new KeySearchCriteria(true, null, null, null);
        PaginatedView<KeyRepresentation> keyRepresentations = keyFinder
                .findKeysWithTheirDefaultTranslation(FIRST_RANGE, criteria);

        assertThat(keyRepresentations.getPageSize()).isEqualTo(2);

        KeyRepresentation representation = keyRepresentations.getView().get(0);
        assertThat(StringUtils.isBlank(representation.getTranslation())).isTrue();
    }
546662
@Column(header = Messages.GUI_HISTORY_DIALOG_COL_LOCALE_0, order = 20)
    public String getLocale() {

        return m_elemComp.getLocale().toString();
    }
699340
public static Locale toLocale(String strLocale, Locale defaultValue) {
	return LocaleFactory.getLocale(strLocale, defaultValue);
    }
512432
static GJLocaleSymbols forLocale(Locale locale) {
        if (locale == null) {
            locale = Locale.getDefault();
        }
        GJLocaleSymbols symbols = cCache.get(locale);
        if (symbols == null) {
            symbols = new GJLocaleSymbols(locale);
            GJLocaleSymbols oldSymbols = cCache.putIfAbsent(locale, symbols);
            if (oldSymbols != null) {
                symbols = oldSymbols;
            }
        }
        return symbols;
    }
1162212
private String localize(String key, String defaultValue) {
    String result = defaultValue;
    if (bundle != null) {
      try {
        result = bundle.getString(key);
      }
      catch (MissingResourceException mre) {
      }
    }
    return result;
  }
227916
Set<Locale> getImplLocales(Class<?> c10nInterface) {
        Set<Locale> res = new HashSet<Locale>();
        C10NImplementationBinder<?> binder = binders.get(c10nInterface);
        if (binder != null) {
            res.addAll(binder.bindings.keySet());
        }
        return res;
    }
1023763
function localizeRelaxed( i18nValue, optionalFallbackValue ) {
         if( !i18nValue || primitives[ typeof i18nValue ] ) {
            // value is not internationalized
            return i18nValue;
         }

         const tag = tags[ locale ];
         const tagParts = tag ? tag.replace( /-/g, '_' ).split( '_' ) : [];
         while( tagParts.length > 0 ) {
            const currentLocaleTag = tagParts.join( '-' );
            const value = localizeStrict( i18nValue, undefined, currentLocaleTag );
            if( value !== undefined ) {
               return value;
            }
            tagParts.pop();
         }

         return fallback ?
            localizeStrict( i18nValue, optionalFallbackValue, fallback ) :
            optionalFallbackValue;
      }
1171849
public ConfigurableMessages getConfigurableMessages(CmsMessages defaultMessages, Locale locale) {

        return new ConfigurableMessages(defaultMessages, locale, m_configuredBundle);

    }
453234
public function getLocale()
    {
        // Use the intl extension if present.
        if (class_exists('\Locale')) {
            $locale = \Locale::acceptFromHttp(@$_SERVER['HTTP_ACCEPT_LANGUAGE']);
        }

        // If no locale was obtained, resort to the default one.
        if (empty($locale)) {
            $locale = Application::getSettings()->locale->default;
        }

        return $locale;
    }