mirror of
https://github.com/unraid/webgui.git
synced 2026-01-19 16:10:17 -06:00
Multi-language support
This commit is contained in:
@@ -116,9 +116,9 @@ function language($method, $xml_file, &$error) {
|
||||
$path = "$docroot/languages/$name";
|
||||
exec("rm -rf $path");
|
||||
@unlink("$docroot/webGui/javascript/translate.$name.js");
|
||||
@unlink("$boot/dynamix.$name.xml");
|
||||
@unlink("$plugins/dynamix.$name.xml");
|
||||
@unlink("$tmp/dynamix.$name.xml");
|
||||
@unlink("$boot/lang-$name.xml");
|
||||
@unlink("$plugins/lang-$name.xml");
|
||||
@unlink("$tmp/lang-$name.xml");
|
||||
@unlink("$boot/dynamix/lang-$name.zip");
|
||||
return true;
|
||||
} else {
|
||||
@@ -150,11 +150,11 @@ $method = $argv[1];
|
||||
|
||||
if ($method == 'checkall') {
|
||||
echo "language: checking all language packs\n";
|
||||
foreach (glob("$plugins/dynamix.*.xml", GLOB_NOSORT) as $link) {
|
||||
foreach (glob("$plugins/lang-*.xml", GLOB_NOSORT) as $link) {
|
||||
$lang_file = @readlink($link);
|
||||
if ($lang_file === false) continue;
|
||||
if (language('LanguageURL', $lang_file, $error) === false) continue;
|
||||
$name = str_replace('dynamix.', '', basename($lang_file, '.xml'));
|
||||
$name = str_replace('lang-', '', basename($lang_file, '.xml'));
|
||||
$lang = language('Language', $lang_file, $error) ?: $name;
|
||||
echo "language: checking $lang language pack ...\n";
|
||||
exec(realpath($argv[0])." check $name >/dev/null");
|
||||
@@ -164,14 +164,14 @@ if ($method == 'checkall') {
|
||||
|
||||
if ($method == 'updateall') {
|
||||
echo "language: updating all language packs\n";
|
||||
foreach (glob("$plugins/dynamix.*.xml", GLOB_NOSORT) as $link) {
|
||||
foreach (glob("$plugins/lang-*.xml", GLOB_NOSORT) as $link) {
|
||||
$lang_file = @readlink($link);
|
||||
if ($lang_file === false) continue;
|
||||
if (language('LanguageURL', $lang_file, $error) === false) continue;
|
||||
$version = language('Version', $lang_file, $error);
|
||||
$name = str_replace('dynamix.', '', basename($lang_file, '.xml'));
|
||||
$name = str_replace('lang-', '', basename($lang_file, '.xml'));
|
||||
$lang = language('Language', $lang_file, $error) ?: $name;
|
||||
$latest = language('Version', "$tmp/dynamix.$name.xml", $error);
|
||||
$latest = language('Version', "$tmp/lang-$name.xml", $error);
|
||||
// update only when newer
|
||||
if (strcmp($latest, $version) > 0) {
|
||||
echo "language: updating $lang language pack ...\n";
|
||||
|
||||
Reference in New Issue
Block a user