inserts a new language into the Database.

@param _language language to be inserted
@return ID of the new language
771860
private long insertNewLanguage(final String _language)
    {
        Long ret = null;
        try {
            final Insert insert = new Insert(CIAdmin.Language);
            insert.add(CIAdmin.Language.Language, _language);
            insert.executeWithoutAccessCheck();
            ret = insert.getId();
            insert.close();
        } catch (final EFapsException e) {
            DBPropertiesUpdate.LOG.error("insertNewLanguage()", e);
        }
        return ret;
    }
283599
protected function getCurrentEditionLang()
    {
        // Return the new language if a change is required.
        if (null !== $edit_language_id = $this->getRequest()->get('edit_language_id', null)) {
            if (null !== $edit_language = LangQuery::create()->findOneById($edit_language_id)) {
                return $edit_language;
            }
        }

        // Otherwise return the lang stored in session.
        return $this->getSession()->getAdminEditionLang();
    }
285930
public function setLang(Lang $language = null)
    {
        $this->language = $language;

        if ($this->originalOrderAndAliases === null) {
            $this->originalOrderAndAliases = $this->orderAndAliases;
        }

        if ($this->language !== null && $this->orderAndAliases !== null) {
            $previousLocale = Translator::getInstance()->getLocale();

            Translator::getInstance()->setLocale($this->language->getLocale());
            foreach ($this->orderAndAliases as &$alias) {
                $alias = Translator::getInstance()->trans($alias);
            }

            Translator::getInstance()->setLocale($previousLocale);
        }

        return $this;
    }
724684
public function setLanguage(\Core\Entity\Language $language = null) {
        $this->language = $language;

        return $this;
    }
170532
private Instance getExistingLocale(final long _propertyid,
                                       final String _language)
    {
        Instance ret = null;
        try {
            final QueryBuilder queryBldr = new QueryBuilder(Type.get(DBPropertiesUpdate.TYPE_PROPERTIES_LOCAL));
            queryBldr.addWhereAttrEqValue("PropertyID", _propertyid);
            queryBldr.addWhereAttrEqValue("LanguageID", getLanguageId(_language));
            final InstanceQuery query = queryBldr.getQuery();
            query.executeWithoutAccessCheck();
            if (query.next()) {
                ret = query.getCurrentValue();
            }
        } catch (final EFapsException e) {
            DBPropertiesUpdate.LOG.error("getExistingLocale(String)", e);
        }
        return ret;
    }
202847
public function addDetectedLanguage($language)
    {
        if (!in_array($language, $this->detectedLanguages)) {
            $this->detectedLanguages[] = $language;
        }

        return $this;
    }
1106182
public function updateLanguage(Language $language)
    {
        $query = $this->dbHandler->createUpdateQuery();
        $query->update($this->dbHandler->quoteTable('ezcontent_language'));

        $this->setCommonLanguageColumns($query, $language);

        $query->where(
            $query->expr->eq(
                $this->dbHandler->quoteColumn('id'),
                $query->bindValue($language->id, null, \PDO::PARAM_INT)
            )
        );

        $query->prepare()->execute();
    }
127186
def from_id(cls, _id, language=DEFAULT_LANG):
        
        db_file = DBVuln.get_file_for_id(_id, language=language)
        data = DBVuln.load_from_json(db_file, language=language)
        return cls(**data)
672924
function createLanguage(linguistData, { extend, override }) {
  const language = {};

  for (const key in linguistData) {
    const newKey = key === "languageId" ? "linguistLanguageId" : key;
    language[newKey] = linguistData[key];
  }

  if (extend) {
    for (const key in extend) {
      language[key] = (language[key] || []).concat(extend[key]);
    }
  }

  for (const key in override) {
    language[key] = override[key];
  }

  return language;
}
351099
def language_id(self):
        
        lang = self._rPr.lang
        if lang is None:
            return MSO_LANGUAGE_ID.NONE
        return self._rPr.lang
784270
def set(self, language: str, value: str):
        

        self[language] = value
        self.__dict__.update(self)
        return self
998434
def add_language_to_project(self, project_id, language_code):
        
        self._run(
            url_path="languages/add",
            id=project_id,
            language=language_code
        )
        return True
12712
public static Locale locale(String language) {
        if (language.contains("_")) {
            String[] sa = language.split("_");
            if (sa.length > 2) {
                return new Locale(sa[0], sa[1], sa[2]);
            } else if (sa.length > 1) {
                return new Locale(sa[0], sa[1]);
            } else {
                return new Locale(sa[0]);
            }
        }
        return new Locale(language);
    }
1001378
public function add()
    {
        $language = $this->Languages->newEntity();
        if ($this->request->is('post')) {
            $data = is_array($this->request->getData()) ? $this->request->getData() : [];
            $languageEntity = $this->Languages->addOrRestore($data);
            if (!empty($languageEntity)) {
                $this->Flash->success((string)__('The language has been saved.'));

                return $this->redirect(['action' => 'index']);
            }
            $this->Flash->error((string)__('The language could not be saved. Please, try again.'));
        }
        $languages = $this->Languages->getAvailable();
        $this->set(compact('language', 'languages'));
        $this->set('_serialize', ['language']);
    }
1184421
public function setLanguage(Language $language)
    {
        $this->language = $language;
        $this->languageId = $language->getLanguageId();
    }
426543
public function init($language = null)
    {
        if (!$language) {
            $language = $this->in('Please specify language code, e.g. `en`, `eng`, `en_US` etc.');
        }
        if (strlen($language) < 2) {
            return $this->error('Invalid language code. Valid is `en`, `eng`, `en_US` etc.');
        }

        $model = $this->param('model');
        if (empty($model)) {
            $model = 'I18nMessages';
        }

        $fields = ['domain', 'singular', 'plural', 'context'];

        $model = TableRegistry::get($model);
        $messages = $model->find()
            ->select($fields)
            ->distinct(['domain', 'singular', 'context'])
            ->enableHydration(false)
            ->toArray();

        $entities = $model->newEntities($messages);

        $return = $model->getConnection()->transactional(
            function () use ($model, $entities, $language) {
                $model->deleteAll([
                    'locale' => $language,
                ]);

                foreach ($entities as $entity) {
                    $entity->set('locale', $language);
                    if ($model->save($entity) === false) {
                        return false;
                    }
                }
            }
        );

        if ($return) {
            $this->out('Created ' . count($messages) . ' messages for "' . $language . '"');
        } else {
            $this->out('Unable to create messages for "' . $language . '"');
        }
    }
839234
def set_language(self, language):
        
        if isinstance(language, str):
            language_obj = languages.getlang(language)
            if language_obj:
                self.language = language_obj.code
            else:
                raise TypeError("Language code {} not found".format(language))
        if isinstance(language, languages.Language):
            self.language = language.code