Get locale
        Will extract locale from application, trying to get one from babel
        first, then, if not available, will get one from app config
6691
def get_locale(self):
        
        if not self.locale:
            try:
                import flask_babel as babel
                self.locale = str(babel.get_locale()).lower()
            except ImportError:
                from flask import current_app
                self.locale = current_app.config['DEFAULT_LOCALE'].lower

        return self.locale
1126595
protected Locale getLocaleToApply() {
		Locale currentLocale = locale;

		if (currentLocale == null) {
			currentLocale = control.getFallbackLocale();
		}
		return currentLocale;
	}
563166
private Locale extractLocale() {

        Locale loc = null;
        int underscore = m_name.lastIndexOf("_");
        if (underscore > -1) {
            String localeName = m_name.substring(underscore + 1);
            if (localeName.lastIndexOf(".") > -1) {
                localeName = localeName.substring(0, localeName.lastIndexOf("."));
            }
            loc = CmsLocaleManager.getLocale(localeName);
        }

        return loc;
    }
758188
private Locale getLocale(String localeName) throws ToolException {
        Locale userlocale = null;
        if (localeName == null || localeName.isEmpty()) {
            return Locale.getDefault();
        }
        int firstuscore = localeName.indexOf('_');
        int seconduscore = -1;
        String language = null;
        String country = null;
        String variant = null;
        if (firstuscore == 2) {
            language = localeName.substring(0, firstuscore);
            seconduscore = localeName.indexOf('_', firstuscore + 1);
            if (seconduscore > 0) {
                if (seconduscore != firstuscore + 3
                        || localeName.length() <= seconduscore + 1) {
                    String text = messager.getText("main.malformed_locale_name", localeName);
                    throw new ToolException(CMDERR, text);
                }
                country = localeName.substring(firstuscore + 1,
                        seconduscore);
                variant = localeName.substring(seconduscore + 1);
            } else if (localeName.length() == firstuscore + 3) {
                country = localeName.substring(firstuscore + 1);
            } else {
                String text = messager.getText("main.malformed_locale_name", localeName);
                throw new ToolException(CMDERR, text);
            }
        } else if (firstuscore == -1 && localeName.length() == 2) {
            language = localeName;
        } else {
            String text = messager.getText("main.malformed_locale_name", localeName);
            throw new ToolException(CMDERR, text);
        }
        userlocale = searchLocale(language, country, variant);
        if (userlocale == null) {
            String text = messager.getText("main.illegal_locale_name", localeName);
            throw new ToolException(CMDERR, text);
        } else {
            return userlocale;
        }
    }
1344068
String getText(String key, Object... args) {
        return messages.getLocalizedString(locale, key, args);
    }
439099
function(path) {
            if (path === undefined) {
                path = document.location.pathname;
            }
            var locale = this.getConfigValue('LOCALE').toString();

            // if there is no way to figure out the locale, just return pathname
            if (!this.getConfigValue('LOCALE') || path.indexOf(locale) == -1) {
                return path;
            }
            var start = locale.length + path.indexOf(locale);
            return path.slice(start);
        }
314797
private void initializeLocale() {
        final String locale = getProperty(LOCALE, applicationProperties);
        if (locale != null && !"".equals(locale)) {
            final String[] localeParts = locale.split("_");
            if (localeParts.length == 2) {
                currentLocale = new Locale(localeParts[0], localeParts[1]);
            } else {
                currentLocale = new Locale(localeParts[0]);
            }
        } else {
            currentLocale = Locale.getDefault();
        }
        logger.info(Messages.getMessage(CONTEXT_LOCALE_USED), currentLocale);
    }
225448
def currentLocale(self):
        
        try:
            return babel.Locale.parse(self.itemData(self.currentIndex()))
        except ImportError, err:
            log.error('babel is not installed.')
            return None
750394
def _process_locale(self, locale):
        """"""

        if locale.lower().startswith('en'):
            return False

        return (locale in self.enabled_locales or

                self.reverse_locale_map.get(locale.lower(), None)
                in self.enabled_locales or

                locale in self.lower_locales or

                self.reverse_locale_map.get(locale.lower(), None)
                in self.lower_locales
        )
1154555
@JSFProperty(deferredValueType="java.lang.Object")
    public Locale getLocale()
    {
        if (_locale != null)
        {
            return _locale;
        }
        FacesContext context = FacesContext.getCurrentInstance();
        return context.getViewRoot().getLocale();
    }
1315151
def get_locale ():
    """"""
    try:
        loc, encoding = locale.getdefaultlocale()
    except ValueError:
        # locale configuration is broken - ignore that
        loc, encoding = None, None
    if loc is None:
        loc = "C"
    else:
        loc = norm_locale(loc)
    if encoding is None:
        encoding = "ascii"
    return (loc, encoding)
1138421
def handle(self, locale, app=None, **options):
        
        translation.activate(settings.LANGUAGE_CODE)
        if app:
            unpack = app.split('.')

            if len(unpack) == 2:
                models = [get_model(unpack[0], unpack[1])]
            elif len(unpack) == 1:
                models = get_models(get_app(unpack[0]))
        else:
            models = get_models()
            
        for model in models:
            if hasattr(model, 'localized_fields'):
                i18n.unregister(model)
                model_full_name = '%s.%s' % (model._meta.app_label, model._meta.module_name)
                update_instances = set()
                messages = []
                
                for instance in model.objects.all():
                    for field in model.localized_fields:
                        local_field_name = get_real_fieldname(field, locale)
                        
                        if  hasattr(instance, local_field_name):
                                local_field_value = getattr(instance, local_field_name)
                                if local_field_value not in (None, u''):
                                    setattr(instance, local_field_name, None)
                                
                                    update_instances.add(instance)
                                    messages.append(u"%s %s %s : %s will become reset to None" % (model_full_name, instance, local_field_name, force_unicode(local_field_value)))

                if len(update_instances):
                    if self.ask_for_confirmation(messages, u'%s.%s' % (model._meta.app_label, model._meta.module_name)):
                        for update_instance in update_instances:
                            print u"resetting %s" % update_instance
                            update_instance.save()
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);
        }
    }
924960
public static Locale getLocale() {
        final Locale ret = LOCALE.get();
        if (null == ret) {
            return Latkes.getLocale();
        }

        return ret;
    }
1238354
def get_locale():
    '''
    
    '''
    ret = ''
    lc_ctl = salt.utils.systemd.booted(__context__)
    # localectl on SLE12 is installed but the integration is still broken in latest SP3 due to
    # config is rewritten by by many %post installation hooks in the older packages.
    # If you use it -- you will break your config. This is not the case in SLE15 anymore.
    if lc_ctl and not (__grains__['os_family'] in ['Suse'] and __grains__['osmajorrelease'] in [12]):
        ret = (_parse_dbus_locale() if dbus is not None else _localectl_status()['system_locale']).get('LANG', '')
    else:
        if 'Suse' in __grains__['os_family']:
            cmd = 'grep "^RC_LANG" /etc/sysconfig/language'
        elif 'RedHat' in __grains__['os_family']:
            cmd = 'grep "^LANG=" /etc/sysconfig/i18n'
        elif 'Debian' in __grains__['os_family']:
            # this block only applies to Debian without systemd
            cmd = 'grep "^LANG=" /etc/default/locale'
        elif 'Gentoo' in __grains__['os_family']:
            cmd = 'eselect --brief locale show'
            return __salt__['cmd.run'](cmd).strip()
        elif 'Solaris' in __grains__['os_family']:
            cmd = 'grep "^LANG=" /etc/default/init'
        else:  # don't waste time on a failing cmd.run
            raise CommandExecutionError('Error: "{0}" is unsupported!'.format(__grains__['oscodename']))

        if cmd:
            try:
                ret = __salt__['cmd.run'](cmd).split('=')[1].replace('"', '')
            except IndexError as err:
                log.error('Error occurred while running "%s": %s', cmd, err)

    return ret
454101
@Override
    public Locale getLocale() {
        if (super.getSession(false) == null) {
            return super.getLocale();
        }

        final IUserInstance userInstance =
                this.userInstanceManager.getUserInstance(this.getWrappedRequest());
        final LocaleManager localeManager = userInstance.getLocaleManager();
        final List<Locale> locales = localeManager.getLocales();
        return locales.get(0);
    }
297314
def get(self, key: Text, locale: Optional[Text]) -> List[Tuple[Text, ...]]:
        

        locale = self.choose_locale(locale)

        return self.dict[locale][key]