Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Updated approah using by `USE_L10N = True` and `USE_THOUSAND_SEPARATOR = True` in `settings_global.py`; It doesn't use `intcomma` inside `Humanize`.

Brandon-Lu73782b57803e527
diff --git a/wger/settings_global.py b/wger/settings_global.py
index dd98a6405..454910c66 100644
--- a/wger/settings_global.py
+++ b/wger/settings_global.py
@@ -206,6 +206,7 @@ LOGIN_REDIRECT_URL = '/'
USE_TZ = True
USE_I18N = True
USE_L10N = True
+USE_THOUSAND_SEPARATOR = True
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
diff --git a/wger/software/views.py b/wger/software/views.py
index 49092d381..139f603bf 100644
--- a/wger/software/views.py
+++ b/wger/software/views.py
@@ -55,65 +55,6 @@ def features(request):
"nr_stars": result_github_api.get("stargazers_count", "2000"),
}
- comma_countries = [
- "ca",
- "en",
- "en-au",
- "en-gb",
- "en",
- "es-ar",
- "es-co",
- "zh-hans",
- ]
-
- period_countries = ["de", "es-mx", "es-ni", "el", "es-ve", "it", "nl", "tr"]
-
- space_countries = [
- "bg",
- "es",
- "fr",
- "hr",
- "nb",
- "pl",
- "pt",
- "pt-br",
- "ru",
- "sv",
- "uk",
- ]
-
- def get_format(lang_code):
- if lang_code in comma_countries:
- context["nr_users"] = f"{context['nr_users']:,}"
- context["nr_exercises"] = f"{context['nr_exercises']:,}"
- context["nr_ingredients"] = f"{context['nr_ingredients']:,}"
- context["nr_stars"] = f"{context['nr_stars']:,}"
- elif lang_code in period_countries:
- context["nr_users"] = f"{context['nr_users']:,}".replace(",", ".")
- context["nr_exercises"] = f"{context['nr_exercises']:,}".replace(
- ",", "."
- )
- context["nr_ingredients"] = f"{context['nr_ingredients']:,}".replace(
- ",", "."
- )
- context["nr_stars"] = f"{context['nr_stars']:,}".replace(",", ".")
- elif lang_code in space_countries:
- context["nr_users"] = f"{context['nr_users']:,}".replace(",", " ")
- context["nr_exercises"] = f"{context['nr_exercises']:,}".replace(
- ",", " "
- )
- context["nr_ingredients"] = f"{context['nr_ingredients']:,}".replace(
- ",", " "
- )
- context["nr_stars"] = f"{context['nr_stars']:,}".replace(",", " ")
- else:
- context["nr_users"] = f"{context['nr_users']:,}"
- context["nr_exercises"] = f"{context['nr_exercises']:,}"
- context["nr_ingredients"] = f"{context['nr_ingredients']:,}"
- context["nr_stars"] = f"{context['nr_stars']:,}"
-
- get_format(request.LANGUAGE_CODE)
-
cache.set(CACHE_KEY, context, 60 * 60 * 24 * 7) # one week
FormClass = (