LOCALE_TRANSLATION_REMOTE
and LOCALE_TRANSLATION_LOCAL indicate available new translations,
LOCALE_TRANSLATION_CURRENT indicate that the current translation is them
most recent.
160235
protected function projectsStatus()
    {
        $status_report = [];
        $status = locale_translation_get_status();
        foreach ($status as $project_id => $project) {
            foreach ($project as $langcode => $project_info) {
                $info = '';
                if ($project_info->type == LOCALE_TRANSLATION_LOCAL || $project_info->type == LOCALE_TRANSLATION_REMOTE) {
                    $local = isset($project_info->files[LOCALE_TRANSLATION_LOCAL]) ? $project_info->files[LOCALE_TRANSLATION_LOCAL] : null;
                    $remote = isset($project_info->files[LOCALE_TRANSLATION_REMOTE]) ? $project_info->files[LOCALE_TRANSLATION_REMOTE] : null;
                    $local_age = $local->timestamp? format_date($local->timestamp, 'html_date'): '';
                    $remote_age = $remote->timestamp? format_date($remote->timestamp, 'html_date'): '';

                    if ($local_age >= $remote_age) {
                        $info = $this->trans('commands.locale.translation.status.messages.translation-project-updated');
                    } else {
                        $info = $this->trans('commands.locale.translation.status.messages.translation-project-available');
                    }
                } elseif ($project_info->type == LOCALE_TRANSLATION_CURRENT) {
                    $info = $this->trans('commands.locale.translation.status.messages.translation-project-updated');
                } else {
                    $local_age = '';
                    $remote_age = '';
                    $info = $this->createInfoString($project_info);
                }

                $status_report[$langcode][] = [$project_info->name, $project_info->version, $local_age, $remote_age ,$info ];
            }
        }

        return $status_report;
    }
151689
def most_recent_among(versions):
        
        latest = versions[0]
        for v in versions[1:]:
            if nssversion.first_older_than_second(latest, v):
                latest = v
        return latest
1348717
private function translationsNeedsPluralFix(Translations $translations, LocaleEntity $locale, &$translationsPluralCount)
    {
        $txPlurals = $translations->getPluralForms();
        $translationsPluralCount = isset($txPlurals) ? $txPlurals[0] : null;

        return $translationsPluralCount !== $locale->getPluralCount();
    }
605335
function Translations (params, translations) {

  /** @type {Object} Store current translations source */
  this._translations = {};
  /** @type {Object} Store current stats for latest merge request */
  this._stats = {};
  /** @type {Object} Set default parameters */
  this.params = _.defaults(params, {
    "tree": false,
    "safeMode": false,
    "nullEmpty": false
  });
  // Set translations if given as parameter
  this.setTranslations(translations);
  // Initialize statistics
  this.initStats();

}
396842
def _new_gnu_trans(self, localedir, use_null_fallback=True):
        
        use_null_fallback = False
        return gettext_module.translation(
            domain=self.domain,
            localedir=localedir,
            languages=[self.language],
            codeset='utf-8',
            fallback=use_null_fallback)
153212
public function getCurrentLocale()
    {
        if (!$this->currentLocale instanceof Locale
            || $this->currentLocale->getLanguage() === 'mul') {
            return $this->defaultLocale;
        }
        return $this->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
236814
def set_locale
      self.current_locale = detect_locale

      if set_default_url_option_for_request?
        default_url_options[locale_key] = current_locale
      end

      if locale_from_cookie != current_locale
        cookies[locale_key] = {
          :value => current_locale,
          :expires => RailsLocaleDetection.locale_expiry.from_now
        }
      end
    end
875524
def active_language(self):
        
        # Current instance language (if user uses activate_language() method)
        if self._language is not None:
            return self._language

        # Current site language (translation.get_language())
        current = utils.get_language()
        if current in self.supported_languages:
            return current

        # Default language descriptor
        return self.default_language
1194413
private String messageImportUpdate(Locale locale) {

        return Messages.get().getBundle(locale).key(Messages.ERR_ALIAS_IMPORT_UPDATED_0);
    }
137232
private Map<String, String> getMessagesForLocale() {

        Map<Locale, Map<String, String>> data = getData();
        if (data == null) {
            return Collections.emptyMap();
        }
        List<Locale> available = new ArrayList<Locale>(data.keySet());
        Locale bestMatchingLocale = OpenCms.getLocaleManager().getBestMatchingLocale(
            getLocale(),
            OpenCms.getLocaleManager().getDefaultLocales(),
            available);
        Map<String, String> bundleForLocale = data.get(bestMatchingLocale);
        if (bundleForLocale == null) {
            return Collections.emptyMap();
        } else {
            return Collections.unmodifiableMap(bundleForLocale);
        }
    }
929035
public function activeTranslate($locale)
    {
        $options = $this->getServiceManager()->get('playgroundtranslate_module_options');
        $pathTranslate = $options->getLanguagePath();

        $oldFile = __DIR__.$pathTranslate.$locale.'.php';
        if (file_exists($oldFile)) {
            rename($oldFile, __DIR__.$pathTranslate.'/revisions/'.$locale.'.php.'.date("YmdHis"));
        }

        rename(__DIR__.$pathTranslate.$locale.'.php.tmp', $oldFile);
        
        return true;
    }
891245
public Locale getLocale() {
        UI currentUI = UI.getCurrent();
        Locale locale = currentUI == null ? null : currentUI.getLocale();
        if (locale == null) {
            locale = Locale.getDefault();
        }
        return locale;
    }
243273
def avail(locale):
    '''
    
    '''
    try:
        normalized_locale = salt.utils.locales.normalize_locale(locale)
    except IndexError:
        log.error('Unable to validate locale "%s"', locale)
        return False
    avail_locales = __salt__['locale.list_avail']()
    locale_exists = next((True for x in avail_locales
                          if salt.utils.locales.normalize_locale(x.strip()) == normalized_locale), False)
    return locale_exists
1348213
public function getClientPreferredLocale()
    {
        if (null !== $this->locale) {
            $locale = $this->locale;

        } else {
            // Get detector
            $detector = $this->getDetector();

            // Detect user's preferred locale
            $detector->detect();

            // get the locale from detector
            $locale = $detector->getLocale();
        }

        // return the active locale
        return $locale;
    }
200861
def recent(self, check_language=True, language=None, limit=3, exclude=None,
               kwargs=None, category=None):
        
        if category:
            if not kwargs:
                kwargs = {}
            kwargs['categories__in'] = [category]
        qs = self.published(check_language=check_language, language=language,
                            kwargs=kwargs)
        if exclude:
            qs = qs.exclude(pk=exclude.pk)
        return qs[:limit]
1361427
function translate(singular, plural) {
    if (!locales[currentLocale]) {
        read(currentLocale);
    }

    if (plural) {
        if (!locales[currentLocale][singular]) {
            locales[currentLocale][singular] = {
                'one': singular,
                'other': plural
            };
            write(currentLocale);
        }
    }

    if (!locales[currentLocale][singular]) {
        locales[currentLocale][singular] = singular;
        write(currentLocale);
    }
    return locales[currentLocale][singular];
}