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 2023-04-09 16:02:05 +05:30 committed by James Valleroy
parent f3621a274d
commit 3d1beaf640
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

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