mediawiki: Simplify retrieving the default language

- Mostly to avoid a repeated call to retrieve the list of changes.

- If an unknown value is read, user experience in terms of listed languages and
resetting the new language won't change.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2023-04-27 08:39:28 -04:00
1 parent f3621a274d
commit 3d1beaf640
1 file changed
+2 -8
+2 -8
View File
@@ -14,7 +14,7 @@ from plinth.modules.backups.components import BackupRestore
from plinth.modules.firewall.components import Firewall
from plinth.package import Packages
from . import forms, manifest, privileged
from . import manifest, privileged
_description = [
_('MediaWiki is the wiki engine that powers Wikipedia and other WikiMedia '
@@ -155,10 +155,4 @@ def get_site_name():
def get_default_language():
"""Return the value of MediaWiki's default language"""
default_lang_key = _get_config_value('$wgLanguageCode')
language_choices = forms.get_languages()
for code, name in language_choices:
if code == default_lang_key:
return code
return None
return _get_config_value('$wgLanguageCode') or None