From b9ad86071622b0e12cc5ff7fccc4e094785891fb Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 25 Jan 2021 22:44:38 -0800 Subject: i18n: use babel.numbers.format_number() in web interface --- fatcat_scholar/templates/search.html | 8 ++++---- fatcat_scholar/templates/search_macros.html | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'fatcat_scholar/templates') diff --git a/fatcat_scholar/templates/search.html b/fatcat_scholar/templates/search.html index 2010f0e..164b7fd 100644 --- a/fatcat_scholar/templates/search.html +++ b/fatcat_scholar/templates/search.html @@ -43,7 +43,7 @@ {% if hits %} - {{ "{:,}".format(hits.count_found) }} + {{ babel_numbers.format_number(hits.count_found, locale=locale) }} {% trans trimmed count=hits.count_found %} Hit {% pluralize %} @@ -72,7 +72,7 @@ {% set count_size = "2.0em" %} {% endif %} - {{ "{:,}".format(hits.count_found) }} + {{ babel_numbers.format_number(hits.count_found, locale=locale) }} {% trans trimmed count=hits.count_found %} Hit @@ -122,7 +122,7 @@ {% if hits.offset != 0 %}
- {{ search_macros.search_pagination(hits) }} + {{ search_macros.search_pagination(hits, locale=locale) }}
{% endif %} @@ -136,7 +136,7 @@ {% if hits.count_found > hits.limit %}
- {{ search_macros.search_pagination(hits) }} + {{ search_macros.search_pagination(hits, locale=locale) }}
{% endif %} diff --git a/fatcat_scholar/templates/search_macros.html b/fatcat_scholar/templates/search_macros.html index 5038e65..57d981b 100644 --- a/fatcat_scholar/templates/search_macros.html +++ b/fatcat_scholar/templates/search_macros.html @@ -141,7 +141,7 @@ {% macro journal_row(biblio, paper) -%} {# NOTE: should be able to call with paper.biblio or any paper.release[] #} {% if biblio.release_year %} - {{ biblio.release_year }} + {% trans year=biblio.release_year %}{{ year }}{% endtrans %} {% endif %} {% if biblio.container_name %} @@ -169,7 +169,7 @@ {% endif %} {% endmacro %} -{% macro fulltext_search_result_row(paper, locale=None, debug_mode=False, expand=False) -%} +{% macro fulltext_search_result_row(paper, locale, debug_mode=False, expand=False) -%}
@@ -487,7 +487,7 @@
{# final row close #} {% endmacro %} -{% macro search_pagination(hits, top) %} +{% macro search_pagination(hits, locale) %} {% if hits.offset > 0 %}