Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge fallback locales in lizDict #5195

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading