Skip to content

Commit

Permalink
Fix languages to new path (#3516)
Browse files Browse the repository at this point in the history
  • Loading branch information
partydragen authored Jun 13, 2024
1 parent 7e5eb1b commit 4d3f70d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/Core/pages/panel/general_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
if (isset($_GET['do'])) {
if ($_GET['do'] == 'installLanguage') {
// Install new language
$languages = glob('custom' . DIRECTORY_SEPARATOR . 'languages' . DIRECTORY_SEPARATOR . '*');
$languages = glob('modules' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'language' . DIRECTORY_SEPARATOR . '*');
foreach ($languages as $item) {
// cursed
$short_code = explode('.', explode(DIRECTORY_SEPARATOR, $item)[2])[0];
$short_code = explode('.', explode(DIRECTORY_SEPARATOR, $item)[3])[0];

// Is it already in the database?
$exists = DB::getInstance()->get('languages', ['short_code', $short_code])->results();
Expand Down Expand Up @@ -217,7 +217,7 @@
$languages = DB::getInstance()->get('languages', ['id', '<>', 0])->results();
$count = count($languages);
for ($i = 0; $i < $count; $i++) {
$language_path = implode(DIRECTORY_SEPARATOR, [ROOT_PATH, 'custom', 'languages', $languages[$i]->short_code . '.json']);
$language_path = implode(DIRECTORY_SEPARATOR, [ROOT_PATH, 'modules', 'Core', 'language', $languages[$i]->short_code . '.json']);
if (!file_exists($language_path)) {
unset($languages[$i]);
}
Expand Down
5 changes: 5 additions & 0 deletions modules/Core/pages/user/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,11 @@
$language_query = DB::getInstance()->get('languages', ['id', '<>', 0])->results();

foreach ($language_query as $item) {
$language_path = implode(DIRECTORY_SEPARATOR, [ROOT_PATH, 'modules', 'Core', 'language', $item->short_code . '.json']);
if (!file_exists($language_path)) {
continue;
}

$languages[] = [
'name' => Output::getClean($item->name),
'active' => $user->data()->language_id == $item->id
Expand Down

0 comments on commit 4d3f70d

Please sign in to comment.