Skip to content

Commit

Permalink
Merge fallback locales in lizDict, only if in dev mode with the debug…
Browse files Browse the repository at this point in the history
… toolbar
  • Loading branch information
Gustry committed Jan 28, 2025
1 parent e61dd4b commit b6be3f3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lizmap/modules/view/controllers/translate.classic.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Lizmap\App\LocalesLoader;

/**
* Service to provide translation dictionnary.
* Service to provide translation dictionary.
*
* @author 3liz
* @copyright 2011-2022 3liz
Expand All @@ -15,7 +15,7 @@
class translateCtrl extends jController
{
/**
* Get text/javascript containing all translation for the dictionnary.
* Get text/javascript containing all translation for the dictionary.
*
* @urlparam string $lang Language. Ex: fr_FR (optional)
*
Expand All @@ -36,6 +36,11 @@ public function index()
}

$data = LocalesLoader::getLocalesFrom('view~dictionnary', $lang);

if (strpos(\jApp::config()->jResponseHtml['plugins'], 'debugbar') !== false) {
$fallback = LocalesLoader::getLocalesFrom('view~dictionnary', \jApp::config()->fallbackLocale);
$data = array_merge($fallback, $data);
}
$rep->content = 'var lizDict = '.json_encode($data).';';

return $rep;
Expand Down

0 comments on commit b6be3f3

Please sign in to comment.