diff --git a/Sources/Actions/Admin/Languages.php b/Sources/Actions/Admin/Languages.php index f482db58fa..e0636dba07 100644 --- a/Sources/Actions/Admin/Languages.php +++ b/Sources/Actions/Admin/Languages.php @@ -671,6 +671,11 @@ public function editEntries() Utils::$context['lang_id'] = &$lang_id; + // Neither the forum's own default nor en_US can go. en_US is what + // Lang::load() falls back to for any string the chosen language is + // missing, so a forum without it has no backstop at all. + Utils::$context['can_delete_language'] = $lang_id !== 'en_US' && $lang_id !== Config::$language; + // Get all the theme data. $themes = [ 1 => [ @@ -792,7 +797,7 @@ function ($val1, $val2) { } // We no longer wish to speak this language. - if (!empty($_POST['delete_main']) && $lang_id != 'english') { + if (!empty($_POST['delete_main']) && Utils::$context['can_delete_language']) { User::$me->checkSession(); SecurityToken::validate('admin-mlang'); diff --git a/Themes/default/ManageLanguages.template.php b/Themes/default/ManageLanguages.template.php index 363b3c35c8..ee98000573 100644 --- a/Themes/default/ManageLanguages.template.php +++ b/Themes/default/ManageLanguages.template.php @@ -182,8 +182,8 @@ function template_modify_language_entries() '; - // Allow deleting entries. English can't be deleted though. - if (Utils::$context['lang_id'] != 'english') { + // Allow deleting entries. The default language and en_US can't go. + if (Utils::$context['can_delete_language']) { echo ' '; }