From 3d1beaf640a3cdcbc67ae908af094fb30fea1989 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 9 Apr 2023 16:02:05 +0530 Subject: [PATCH] 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 Reviewed-by: James Valleroy --- plinth/modules/mediawiki/__init__.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/plinth/modules/mediawiki/__init__.py b/plinth/modules/mediawiki/__init__.py index c1d1b3887..785a226e5 100644 --- a/plinth/modules/mediawiki/__init__.py +++ b/plinth/modules/mediawiki/__init__.py @@ -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