Make sure there is at least a translation has been filled in. If a
        default language has been specified, make sure that it exists amongst
        translations.
484046
def clean(self):
        

        # First make sure the super's clean method is called upon.
        super(TranslationFormSet, self).clean()

        if settings.HIDE_LANGUAGE:
            return

        if len(self.forms) > 0:
            # If a default language has been provided, make sure a translation
            # is available

            if settings.DEFAULT_LANGUAGE and not any(self.errors):
                # Don't bother validating the formset unless each form is
                # valid on its own. Reference:
                # http://docs.djangoproject.com/en/dev/topics/forms/formsets/#custom-formset-validation

                for form in self.forms:
                    language_code = form.cleaned_data.get(
                        'language_code', None
                    )

                    if language_code == settings.DEFAULT_LANGUAGE:

                        # All is good, don't bother checking any further
                        return

                raise forms.ValidationError(_(
                    'No translation provided for default language \'%s\'.'
                ) % settings.DEFAULT_LANGUAGE)

        else:
            raise forms.ValidationError(
                _('At least one translation should be provided.')
            )
505812
protected function refreshLanguage()
    {
        $this->controlToken('refresh');

        $code = $this->getQuery('refresh');
        if (!empty($code) && $this->access('language_edit') && $this->translation->refresh($code)) {
            $this->redirect('', $this->text('Language has been refreshed'), 'success');
        }
    }
1147387
def translation(language):
    
    global _translations
    if language not in _translations:
        _translations[language] = Translations(language)
    return _translations[language]
1074749
public function handleLanguageIntoSession()
    {
        $this->settingsCommonLib();
        $this->initializeSprGlbAndSession();
        if (is_null($this->tCmnSuperGlobals->get('lang')) && is_null($this->tCmnSession->get('lang'))) {
            $this->tCmnSession->set('lang', $this->commonLibFlags['default_language']);
        } elseif (!is_null($this->tCmnSuperGlobals->get('lang'))) {
            $this->tCmnSession->set('lang', filter_var($this->tCmnSuperGlobals->get('lang'), FILTER_SANITIZE_STRING));
        }
        $this->normalizeLocalizationIntoSession();
    }
425522
def translation
      if translation_enabled? 
        if !@translation || (@translation.locale != translation_locale)
          raise MissingParent, "Cannot create translations without a stored parent" if new_record?
          # try to find translation or build a new one
          @translation = translations.where(:locale => translation_locale).first || translations.build(:locale => translation_locale)
        end
        @translation
      else
        nil
      end
    end
166479
def translate(self):
        """"""
        visitor = CheckTranslator(self.document,
                                  contents=self.contents,
                                  filename=self.filename,
                                  ignore=self.ignore)
        self.document.walkabout(visitor)
        self.checkers += visitor.checkers
52921
function translate(key, options, hasOwnOptions) {

			var lng = options.lng || 'auto';

			if (!translations[lng]) {
				translations[lng] = {};
			}

			if (!t) {

				translations[lng][key] = 'defaultLoadingValue' in options ? options.defaultLoadingValue :
					'defaultValue' in options ? options.defaultValue :
					'defaultLoadingValue' in globalOptions ? globalOptions.defaultLoadingValue : key;

			} else if (!translations[lng][key] || hasOwnOptions) {

				translations[lng][key] = t(key, options);

			}

		}
905848
protected function wizardAddLanguage()
    {
        $this->validatePrompt('code', $this->text('Code'), 'language');
        $this->validatePrompt('name', $this->text('Name'), 'language', '');
        $this->validatePrompt('native_name', $this->text('Native name'), 'language', '');
        $this->validatePrompt('status', $this->text('Status'), 'language', 0);
        $this->validatePrompt('default', $this->text('Default') . '?', 'language', 0);
        $this->validatePrompt('weight', $this->text('Weight'), 'language', 0);
        $this->validatePrompt('rtl', $this->text('Right-to-left') . '?', 'language', 0);

        $this->validateComponent('language');
        $this->addLanguage();
    }
756663
function(translateAttr, translationId, scope, interpolateParams, defaultTranslationText) {
          if (translationId) {
            $translate(translationId, interpolateParams, translateInterpolation, defaultTranslationText)
              .then(function (translation) {
                applyTranslation(translation, scope, true, translateAttr);
              }, function (translationId) {
                applyTranslation(translationId, scope, false, translateAttr);
              });
          } else {
            // as an empty string cannot be translated, we can solve this using successful=false
            applyTranslation(translationId, scope, false, translateAttr);
          }
        }
94064
protected function submitEditLanguage()
    {
        if ($this->isPosted('delete')) {
            $this->deleteLanguage();
        } else if ($this->isPosted('save') && $this->validateLanguage()) {
            if (isset($this->data_language['code'])) {
                $this->updateLanguage();
            } else {
                $this->addLanguage();
            }
        }
    }
45881
public function hasTranslation($language_id = null, $checkIsPublished = true)
    {
        /** @var \DevGroup\Multilingual\Multilingual $multilingual */
        $multilingual = Yii::$app->multilingual;
        if ($language_id === null) {
            $language_id = $multilingual->language_id;
        }
        /** @var ActiveRecord $owner */
        $owner = $this->owner;

        if ($language_id === $multilingual->language_id) {
            // we were asked for default language
            /** @var ActiveRecord $translation */
            $translation = $owner->{$this->defaultTranslationRelation};
            if ($translation === null) {
                return false;
            }

            if ($checkIsPublished === true) {
                return $this->checkIsPublished($translation);
            }
        }

        /* @var ActiveRecord $translation */
        foreach ($owner->{$this->translationRelation} as $translation) {
            if ($translation->getAttribute('language_id') === $language_id) {
                if ($checkIsPublished === true) {
                    return $this->checkIsPublished($translation);
                } else {
                    return true;
                }
            }
        }
        return false;
    }
926511
private function checkCompileInput()
    {
        
        $defaults = array('extension' => null,
                          'language' => null,
                          'input' => dirname(__FILE__) . '/../../' . $this->options['extension'] . '/' . self::DEF_INPUT_DIR,
                          'output' => dirname(__FILE__) . '/../../' . $this->options['extension'] . '/' . self::DEF_OUTPUT_DIR);
                          
        $this->options = array_merge($defaults, $this->options);
        
        if ($this->options['extension'] == null){
            $this->err("Please provide the 'extension' parameter.", true);
        }
        else if ($this->options['language'] == null){
            $this->err("Please provide the 'language' parameter.", true);
        }
        
    }
360011
private function ensureHrefDefaultsToNull()
    {
        if (!($this->database->tableExists('tl_metamodel_translatedurl'))) {
            return;
        }

        foreach ($this->database->listFields('tl_metamodel_translatedurl', true) as $field) {
            if ('href' == $field['name'] && $field['type'] != 'index') {
                // Already updated?
                if ('NOT NULL' === $field['null']) {
                    $this->database->execute(
                        'ALTER TABLE `tl_metamodel_translatedurl` CHANGE `href` `href` varchar(255) NULL;'
                    );
                    return;
                }
                // Found!
                break;
            }
        }
    }
535693
def install_language(cls, language_code):
        
        # Skip if the language is already installed
        if language_code == cls.language:
            return
        try:
            cls._active_catalogs = cls._translation_catalogs[language_code]
            cls.language = language_code
            log.debug('Installed language %s', language_code)
        except KeyError:
            default = settings.DEFAULT_LANG
            log.warning('Unknown language %s, falling back to %s', language_code, default)
            cls._active_catalogs = cls._translation_catalogs[default]
            cls.language = default
316321
def validate_language_management
      # admins can do everything
      return if tr8n_current_user_is_admin?
    
      if tr8n_current_language.default?
        trfe("Only administrators can modify this language")
        return redirect_to(tr8n_features_tabs.first[:link])
      end

      unless tr8n_current_user_is_translator? and tr8n_current_translator.manager? 
        trfe("In order to manage a language you first must request to become a manager of that language.")
        return redirect_to(tr8n_features_tabs.first[:link])
      end
    end
722294
protected function checkIfTranslationExists($linkPageUid, $requestLanguage)
    {
        if ($requestLanguage === 0) {
            //default language always exists
            return true;
        }
        $translated =  BackendUtility::getRecordLocalization('pages', $linkPageUid, $requestLanguage);
        if ($translated === false || $translated === null) {
            //translation does not exist
            return false;
        }
        return true;
    }
273372
def add_localedir_translations(self, localedir):
        """"""
        global _localedirs
        if localedir in self.localedirs:
            return
        self.localedirs.append(localedir)
        full_localedir = os.path.join(localedir, 'locale')
        if os.path.exists(full_localedir):
            translation = self._new_gnu_trans(full_localedir)
            self.merge(translation)