Skip to content

Commit

Permalink
Move lang helper to shared trait
Browse files Browse the repository at this point in the history
  • Loading branch information
samgeorges committed Sep 16, 2022
1 parent f8d8c0f commit d539451
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 51 deletions.
59 changes: 8 additions & 51 deletions modules/system/traits/SetupBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ public function getBasePath($path = '')
return base_path($path);
}

/**
* getLang
*/
public function getLang($key, $vars = [])
{
return Lang::get($key, $vars);
}

/**
* setupInstallOctober installs October CMS using composer
*/
Expand Down Expand Up @@ -201,55 +209,4 @@ protected function nonInteractiveCheck(): bool
{
return (microtime(true) - LARAVEL_START) < 1;
}

/**
* getAvailableLocales returns available system locales
*/
protected function getAvailableLocales()
{
return [
'ar' => [Lang::get('system::lang.locale.ar'), 'Arabic'],
'be' => [Lang::get('system::lang.locale.be'), 'Belarusian'],
'bg' => [Lang::get('system::lang.locale.bg'), 'Bulgarian'],
'ca' => [Lang::get('system::lang.locale.ca'), 'Catalan'],
'cs' => [Lang::get('system::lang.locale.cs'), 'Czech'],
'da' => [Lang::get('system::lang.locale.da'), 'Danish'],
'de' => [Lang::get('system::lang.locale.de'), 'German'],
'el' => [Lang::get('system::lang.locale.el'), 'Greek'],
'en' => [Lang::get('system::lang.locale.en'), 'English'],
'en-au' => [Lang::get('system::lang.locale.en-au'), 'English'],
'en-ca' => [Lang::get('system::lang.locale.en-ca'), 'English'],
'en-gb' => [Lang::get('system::lang.locale.en-gb'), 'English'],
'es' => [Lang::get('system::lang.locale.es'), 'Spanish'],
'es-ar' => [Lang::get('system::lang.locale.es-ar'), 'Spanish'],
'et' => [Lang::get('system::lang.locale.et'), 'Estonian'],
'fa' => [Lang::get('system::lang.locale.fa'), 'Persian'],
'fi' => [Lang::get('system::lang.locale.fi'), 'Finnish'],
'fr' => [Lang::get('system::lang.locale.fr'), 'French'],
'fr-ca' => [Lang::get('system::lang.locale.fr-ca'), 'French'],
'hu' => [Lang::get('system::lang.locale.hu'), 'Hungarian'],
'id' => [Lang::get('system::lang.locale.id'), 'Indonesian'],
'it' => [Lang::get('system::lang.locale.it'), 'Italian'],
'ja' => [Lang::get('system::lang.locale.ja'), 'Japanese'],
'kr' => [Lang::get('system::lang.locale.kr'), 'Korean'],
'lt' => [Lang::get('system::lang.locale.lt'), 'Lithuanian'],
'lv' => [Lang::get('system::lang.locale.lv'), 'Latvian'],
'nb-no' => [Lang::get('system::lang.locale.nb-no'), 'Norwegian'],
'nl' => [Lang::get('system::lang.locale.nl'), 'Dutch'],
'pl' => [Lang::get('system::lang.locale.pl'), 'Polish'],
'pt-br' => [Lang::get('system::lang.locale.pt-br'), 'Portuguese'],
'pt-pt' => [Lang::get('system::lang.locale.pt-pt'), 'Portuguese'],
'ro' => [Lang::get('system::lang.locale.ro'), 'Romanian'],
'ru' => [Lang::get('system::lang.locale.ru'), 'Russian'],
'sk' => [Lang::get('system::lang.locale.sk'), 'Slovak'],
'sl' => [Lang::get('system::lang.locale.sl'), 'Slovene'],
'sv' => [Lang::get('system::lang.locale.sv'), 'Swedish'],
'th' => [Lang::get('system::lang.locale.th'), 'Thai'],
'tr' => [Lang::get('system::lang.locale.tr'), 'Turkish'],
'uk' => [Lang::get('system::lang.locale.uk'), 'Ukrainian'],
'vn' => [Lang::get('system::lang.locale.vn'), 'Vietnamese'],
'zh-cn' => [Lang::get('system::lang.locale.zh-cn'), 'Chinese'],
'zh-tw' => [Lang::get('system::lang.locale.zh-tw'), 'Chinese'],
];
}
}
51 changes: 51 additions & 0 deletions modules/system/traits/SetupHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,4 +299,55 @@ protected function mergeRecursive(array $array1, $array2)

return $array1;
}

/**
* getAvailableLocales returns available system locales
*/
public function getAvailableLocales()
{
return [
'ar' => [$this->getLang('system::lang.locale.ar'), 'Arabic'],
'be' => [$this->getLang('system::lang.locale.be'), 'Belarusian'],
'bg' => [$this->getLang('system::lang.locale.bg'), 'Bulgarian'],
'ca' => [$this->getLang('system::lang.locale.ca'), 'Catalan'],
'cs' => [$this->getLang('system::lang.locale.cs'), 'Czech'],
'da' => [$this->getLang('system::lang.locale.da'), 'Danish'],
'de' => [$this->getLang('system::lang.locale.de'), 'German'],
'el' => [$this->getLang('system::lang.locale.el'), 'Greek'],
'en' => [$this->getLang('system::lang.locale.en'), 'English'],
'en-au' => [$this->getLang('system::lang.locale.en-au'), 'English'],
'en-ca' => [$this->getLang('system::lang.locale.en-ca'), 'English'],
'en-gb' => [$this->getLang('system::lang.locale.en-gb'), 'English'],
'es' => [$this->getLang('system::lang.locale.es'), 'Spanish'],
'es-ar' => [$this->getLang('system::lang.locale.es-ar'), 'Spanish'],
'et' => [$this->getLang('system::lang.locale.et'), 'Estonian'],
'fa' => [$this->getLang('system::lang.locale.fa'), 'Persian'],
'fi' => [$this->getLang('system::lang.locale.fi'), 'Finnish'],
'fr' => [$this->getLang('system::lang.locale.fr'), 'French'],
'fr-ca' => [$this->getLang('system::lang.locale.fr-ca'), 'French'],
'hu' => [$this->getLang('system::lang.locale.hu'), 'Hungarian'],
'id' => [$this->getLang('system::lang.locale.id'), 'Indonesian'],
'it' => [$this->getLang('system::lang.locale.it'), 'Italian'],
'ja' => [$this->getLang('system::lang.locale.ja'), 'Japanese'],
'kr' => [$this->getLang('system::lang.locale.kr'), 'Korean'],
'lt' => [$this->getLang('system::lang.locale.lt'), 'Lithuanian'],
'lv' => [$this->getLang('system::lang.locale.lv'), 'Latvian'],
'nb-no' => [$this->getLang('system::lang.locale.nb-no'), 'Norwegian'],
'nl' => [$this->getLang('system::lang.locale.nl'), 'Dutch'],
'pl' => [$this->getLang('system::lang.locale.pl'), 'Polish'],
'pt-br' => [$this->getLang('system::lang.locale.pt-br'), 'Portuguese'],
'pt-pt' => [$this->getLang('system::lang.locale.pt-pt'), 'Portuguese'],
'ro' => [$this->getLang('system::lang.locale.ro'), 'Romanian'],
'ru' => [$this->getLang('system::lang.locale.ru'), 'Russian'],
'sk' => [$this->getLang('system::lang.locale.sk'), 'Slovak'],
'sl' => [$this->getLang('system::lang.locale.sl'), 'Slovene'],
'sv' => [$this->getLang('system::lang.locale.sv'), 'Swedish'],
'th' => [$this->getLang('system::lang.locale.th'), 'Thai'],
'tr' => [$this->getLang('system::lang.locale.tr'), 'Turkish'],
'uk' => [$this->getLang('system::lang.locale.uk'), 'Ukrainian'],
'vn' => [$this->getLang('system::lang.locale.vn'), 'Vietnamese'],
'zh-cn' => [$this->getLang('system::lang.locale.zh-cn'), 'Chinese'],
'zh-tw' => [$this->getLang('system::lang.locale.zh-tw'), 'Chinese'],
];
}
}

0 comments on commit d539451

Please sign in to comment.