Skip to content

Commit

Permalink
i18n: Flags Codes
Browse files Browse the repository at this point in the history
This updates the `include/class.i18n.php` file to fix issues with lang
codes. When building packs for languages with codes that have locales
(eg. `sv-SE`) the pack name use underscores, not dashes. This updates
the places we lookup by lang code and replaces `-` with `_` so they are
found correctly.
  • Loading branch information
JediKev committed Jul 13, 2023
1 parent 3ee1111 commit 45f5b5b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/class.i18n.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ static function getLanguageDescription($lang) {
global $thisstaff, $thisclient;

$langs = self::availableLanguages();
$lang = strtolower($lang);
$lang = str_replace('-', '_', strtolower($lang));
if (isset($langs[$lang])) {
$info = &$langs[$lang];
if (!isset($info['desc'])) {
Expand Down Expand Up @@ -213,7 +213,7 @@ static function getLanguageDescription($lang) {

static function getLanguageInfo($lang) {
$langs = self::availableLanguages();
return @$langs[strtolower($lang)] ?: array();
return @$langs[str_replace('-', '_', strtolower($lang))] ?: array();
}

static function availableLanguages($base=I18N_DIR) {
Expand Down

0 comments on commit 45f5b5b

Please sign in to comment.