Adds a new language

@return boolean
552308
protected function addLanguage()
    {
        try {
            $result = $this->languageManager
                ->set(null)
                ->save($this->defaultLanguage)
            ;

            if (! $result) {
                $this->errorMessage = "An error occoured during the saving of the new language";
            }

            return $result;
        } catch (\Exception $ex) {
            $this->errorMessage = "An error occoured during the saving of the new language. The reported error is: " . $ex->getMessage();

            return false;
        }
    }
1139369
public function add()
    {
        $position = $this->BannersPositions->newEntity();

        if ($this->request->is('post')) {
            $position = $this->BannersPositions->patchEntity($position, $this->request->getData());

            if ($this->BannersPositions->save($position)) {
                $this->Flash->success(I18N_OPERATION_OK);

                return $this->redirect(['action' => 'index']);
            }

            $this->Flash->error(I18N_OPERATION_NOT_OK);
        }

        $this->set(compact('position'));
    }
454049
public function add()
    {
        $this->loadModel('Taxonomy.Vocabularies');
        $vocabulary = $this->Vocabularies->newEntity();

        if ($this->request->data()) {
            $vocabulary = $this->Vocabularies->patchEntity($vocabulary, $this->request->data, [
                'fieldList' => [
                    'name',
                    'description',
                ],
            ]);

            if ($this->Vocabularies->save($vocabulary, ['atomic' => true])) {
                $this->Flash->success(__d('taxonomy', 'Vocabulary has been created, now you can start adding terms!'));
                $this->redirect(['plugin' => 'Taxonomy', 'controller' => 'terms', 'action' => 'add', $vocabulary->id]);
            } else {
                $this->Flash->danger(__d('taxonomy', 'Vocabulary could not be created, please check your information'));
            }
        }

        $this->title(__d('taxonomy', 'Create New Vocabulary'));
        $this->set('vocabulary', $vocabulary);
        $this->Breadcrumb
            ->push('/admin/system/structure')
            ->push(__d('taxonomy', 'Taxonomy'), '/admin/taxonomy/manage')
            ->push(__d('taxonomy', 'Vocabularies'), ['plugin' => 'Taxonomy', 'controller' => 'vocabularies', 'action' => 'index'])
            ->push(__d('taxonomy', 'Crating new vocabulary'), '#');
    }
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();
            }
        }
    }
606811
public function add(array $translations, $override = false)
    {
        if ($override) {
            $this->_data = array_merge($this->_data, $translations);
        } else {
            $this->_data = array_merge($translations, $this->_data);
        }

        return true;
    }
1148444
public function actionCreate() {
        $languageForm = Yii::createObject([
                    'class' => Language::className(),
                    'scenario' => 'create'
        ]);

        if ($languageForm->load(Yii::$app->request->post()) && $languageForm->save()) {
            Yii::$app->getSession()->setFlash('success', Yii::t('multilang', 'Language was created.'));
        } else {
            Yii::$app->getSession()->setFlash('danger', Yii::t('multilang', 'Language creation failed.'));
        }
        return $this->redirect(Url::toRoute(['index']));
    }
749265
public function createNew()
    {
        $resource = $this->factory->createNew();

        if (!$resource instanceof TranslatableInterface) {
            throw new UnexpectedTypeException($resource, TranslatableInterface::class);
        }

        $resource->setCurrentLocale($this->localeProvider->getDefaultLocaleCode());
        $resource->setFallbackLocale($this->localeProvider->getDefaultLocaleCode());

        return $resource;
    }
801400
public function language()
    {
        $languages = [
            'en_US' => [
                'url' => '/installer/startup/requirements?locale=en_US',
                'welcome' => 'Welcome to QuickAppsCMS',
                'action' => 'Click here to install in English'
            ]
        ];

        $Folder = new Folder(Plugin::classPath('Installer') . 'Locale');
        foreach ($Folder->read(false, true, true)[0] as $path) {
            $code = basename($path);
            $file = $path . '/installer.po';

            if (is_readable($file)) {
                I18n::locale($code); // trick for __d()
                $languages[$code] = [
                    'url' => "/installer/startup/requirements?locale={$code}",
                    'welcome' => __d('installer', 'Welcome to QuickAppsCMS'),
                    'action' => __d('installer', 'Click here to install in English')
                ];
            }
        }

        I18n::locale('en_US');
        $this->title('Welcome to QuickAppsCMS');
        $this->set('languages', $languages);
        $this->_step();
    }
937659
public function register()
    {
        $this->app->singleton('command.languages.update', function ($app)
        {
            return new LanguagesUpdateCommand($app['language'], $app['files']);
        });

        $this->commands('command.languages.update');
    }
188780
public function addLanguageValues($values)
    {
        $this->_languageValues = array_unique(array_merge($this->getLanguageValues(true), $this->filterLanguageValues($values)));
    }
592472
function addMagicWordsByLang( $newWords ) {
		$code = $this->getCode();
		$fallbackChain = array();
		while ( $code && !in_array( $code, $fallbackChain ) ) {
			$fallbackChain[] = $code;
			$code = self::getFallbackFor( $code );
		}
		if ( !in_array( 'en', $fallbackChain ) ) {
			$fallbackChain[] = 'en';
		}
		$fallbackChain = array_reverse( $fallbackChain );
		foreach ( $fallbackChain as $code ) {
			if ( isset( $newWords[$code] ) ) {
				$this->mMagicExtensions = $newWords[$code] + $this->mMagicExtensions;
			}
		}
	}
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
24176
protected function InitLanguageFile()
    {
        if ($this->language == null)
            $this->language = new Language();

        $this->InitRecLanguageFile(get_class($this));
    }
95723
private function add($data, $language) {
        $parts = explode('-', $language); // To manage language with region (fr-CI, en-US, etc.)
        foreach($data as $key => $translation) {
            if (count($parts) == 1) {
                $this->translations[$language][$key] = $translation;
            } elseif (count($parts) == 2) {
                $this->translations[$parts[0]][$parts[1]][$key] = $translation;
            } else {
                throw new TranslationException('Invalid language');
            }
        }
    }
1221613
public function change()
    {
        $tableName = 'language_translations';
        if (!$this->hasTable($tableName)) {
            $tableName = 'translations';
        }

        $table = $this->table($tableName);
        if (!$table->hasColumn('is_active')) {
            $table->addColumn('is_active', 'boolean', [
                'default' => 0,
                'null' => false,
            ]);
        }
        $table->update();
    }
928181
public function add()
    {
        $this->loadModel('Locale.Languages');
        $language = $this->Languages->newEntity();
        $languages = LocaleToolbox::languagesList(true);
        $icons = LocaleToolbox::flagsList();

        if (!empty($this->request->data['code'])) {
            $info = LocaleToolbox::info($this->request->data['code']);
            $language = $this->Languages->patchEntity($language, [
                'code' => normalizeLocale($this->request->data['code']),
                'name' => $info['language'],
                'direction' => $info['direction'],
                'status' => (isset($this->request->data['status']) ? $this->request->data['status'] : false),
                'icon' => (!empty($this->request->data['icon']) ? $this->request->data['icon'] : null)
            ]);

            if ($this->Languages->save($language)) {
                $this->Flash->success(__d('locale', 'Language was successfully registered!'));
                $this->redirect(['plugin' => 'Locale', 'controller' => 'manage', 'action' => 'index']);
            } else {
                $this->Flash->danger(__d('locale', 'Language could not be registered, please check your information'));
            }
        }

        $this->title(__d('locale', 'Register New Language'));
        $this->set(compact('language', 'languages', 'icons'));
        $this->Breadcrumb
            ->push('/admin/locale')
            ->push(__d('locale', 'Add new language'), '');
    }
1086558
public function installLanguage($languageName)
	{
		$this->amOnPage('administrator/index.php?option=com_installer&view=languages');
		$this->debug('I check for Notices and Warnings');
		$this->checkForPhpNoticesOrWarnings();
		$this->debug('Refreshing languages');
		$this->click(array('xpath' => "//div[@id='toolbar-refresh']/button"));
		$this->waitForElement(array('id' => 'j-main-container'), 30);
		$this->searchForItem($languageName);
		$this->waitForElement($this->searchResultLanguageName($languageName), 30);
		$this->click(array('id' => "cb0"));
		$this->click(array('xpath' => "//div[@id='toolbar-upload']/button"));
		$this->waitForText('was successful.', TIMEOUT, array('id' => 'system-message-container'));
		$this->see('No Matching Results', '.alert-no-items');
		$this->debug($languageName . ' successfully installed');
	}