From 4026523a2eeb1d40e2c0eda14618b5894a38f1c5 Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Tue, 13 Sep 2022 20:59:14 +0200 Subject: [PATCH 1/2] [REMOVED] Unnecessary `lambda` statement The `lambda` statement in `base.py` is unnecessary and has no effect. ```py ugettext = lambda s: s LANGUAGES = ( ("en", ugettext("English")), ("de", ugettext("German")), ("es", ugettext("Spanish")), ("zh-hans", ugettext("Chinese Simplified")), ("ru", ugettext("Russian")), ("ko", ugettext("Korean")), ("fr", ugettext("French")), ("ja", ugettext("Japanese")), ("it", ugettext("Italian")), ) ``` In this case `ugettext = lambda s: s` is pretty much the same as: ```py def ugettext(s): return s ``` And would simply return the string the function receives as parameter. So we can omit this completely and simplify the `LANGUAGES` list to: ```py LANGUAGES = ( ("en", "English"), ("de", "German"), ("es", "Spanish"), ("zh-hans", "Chinese Simplified"), ("ru", "Russian"), ("ko", "Korean"), ("fr", "French"), ("ja", "Japanese"), ("it", "Italian"), ) ``` --- .../project_name/settings/base.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/allianceauth/project_template/project_name/settings/base.py b/allianceauth/project_template/project_name/settings/base.py index 80edcdc9..90f1ff18 100644 --- a/allianceauth/project_template/project_name/settings/base.py +++ b/allianceauth/project_template/project_name/settings/base.py @@ -84,17 +84,16 @@ LOCALE_PATHS = ( os.path.join(BASE_DIR, 'locale/'), ) -ugettext = lambda s: s LANGUAGES = ( - ('en', ugettext('English')), - ('de', ugettext('German')), - ('es', ugettext('Spanish')), - ('zh-hans', ugettext('Chinese Simplified')), - ('ru', ugettext('Russian')), - ('ko', ugettext('Korean')), - ('fr', ugettext('French')), - ('ja', ugettext('Japanese')), - ('it', ugettext('Italian')), + ("en", "English"), + ("de", "German"), + ("es", "Spanish"), + ("zh-hans", "Chinese Simplified"), + ("ru", "Russian"), + ("ko", "Korean"), + ("fr", "French"), + ("ja", "Japanese"), + ("it", "Italian"), ) TEMPLATES = [ From 9cbabee1260c034fa8a7adb4b591d14efaa8e1f5 Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Tue, 13 Sep 2022 21:00:31 +0200 Subject: [PATCH 2/2] [CHANGE] Language names always start with a capital letter --- allianceauth/authentication/templates/public/lang_select.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/allianceauth/authentication/templates/public/lang_select.html b/allianceauth/authentication/templates/public/lang_select.html index 1e2e0e2c..90a135d3 100644 --- a/allianceauth/authentication/templates/public/lang_select.html +++ b/allianceauth/authentication/templates/public/lang_select.html @@ -6,7 +6,7 @@ {% get_language_info_list for LANGUAGES as languages %} {% for language in languages %} {% endfor %}