Skip to content

Commit

Permalink
refactor: unify locale file naming in getLocaleFile function
Browse files Browse the repository at this point in the history
  • Loading branch information
edmondas committed Dec 4, 2023
1 parent 2aacd6b commit ca24b54
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions install/helpers/locale_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

use Poweradmin\Application\Presenter\ErrorPresenter;
use Poweradmin\Domain\Error\ErrorMessage;

function getLocaleFile(string $iface_lang): string
{
if (in_array($iface_lang, ['cs_CZ', 'de_DE', 'fr_FR', 'ja_JP', 'nb_NO', 'nl_NL', 'pl_PL', 'ru_RU', 'tr_TR', 'zh_CN'])) {
$short_locale = substr($iface_lang, 0, 2);
return dirname(__DIR__, 2) . "/locale/$iface_lang/LC_MESSAGES/$short_locale.po";
return dirname(__DIR__, 2) . "/locale/$iface_lang/LC_MESSAGES/messages.po";
}
return dirname(__DIR__, 2) . "/locale/en_EN/LC_MESSAGES/en.po";
}
Expand Down
3 changes: 1 addition & 2 deletions lib/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ public function config($name): mixed
public function getLocaleFile(string $iface_lang): string
{
if (in_array($iface_lang, ['cs_CZ', 'de_DE', 'fr_FR', 'ja_JP', 'nb_NO', 'nl_NL', 'pl_PL', 'ru_RU', 'tr_TR', 'zh_CN'])) {
$short_locale = substr($iface_lang, 0, 2);
return "locale/$iface_lang/LC_MESSAGES/$short_locale.po";
return "locale/$iface_lang/LC_MESSAGES/messages.po";
}
return "locale/en_EN/LC_MESSAGES/en.po";
}
Expand Down

0 comments on commit ca24b54

Please sign in to comment.