aboutsummaryrefslogtreecommitdiffstats
path: root/fatcat_scholar/templates
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-01-25 22:44:38 -0800
committerBryan Newbold <bnewbold@archive.org>2021-01-25 22:44:38 -0800
commitb9ad86071622b0e12cc5ff7fccc4e094785891fb (patch)
treecb566c0c5005b48d5260a56786a0e0e123b58548 /fatcat_scholar/templates
parent9e73da0e40f7cf38de0ae3413fdf0d202493525d (diff)
downloadfatcat-scholar-b9ad86071622b0e12cc5ff7fccc4e094785891fb.tar.gz
fatcat-scholar-b9ad86071622b0e12cc5ff7fccc4e094785891fb.zip
i18n: use babel.numbers.format_number() in web interface
Diffstat (limited to 'fatcat_scholar/templates')
-rw-r--r--fatcat_scholar/templates/search.html8
-rw-r--r--fatcat_scholar/templates/search_macros.html10
2 files changed, 10 insertions, 8 deletions
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 @@
</details>
{% if hits %}
- <span class="hit-count" style="font-size: 1.5em;">{{ "{:,}".format(hits.count_found) }}</span>
+ <span class="hit-count" style="font-size: 1.5em;">{{ babel_numbers.format_number(hits.count_found, locale=locale) }}</span>
{% trans trimmed count=hits.count_found %}
Hit
{% pluralize %}
@@ -72,7 +72,7 @@
{% set count_size = "2.0em" %}
{% endif %}
<span class="hit-count" style="display: block; font-size: {{ count_size }};">
- {{ "{:,}".format(hits.count_found) }}
+ {{ babel_numbers.format_number(hits.count_found, locale=locale) }}
</span>
{% trans trimmed count=hits.count_found %}
Hit
@@ -122,7 +122,7 @@
{% if hits.offset != 0 %}
<div style="margin-bottom: 2em; width: 100%;">
<div class="search-pagination">
- {{ search_macros.search_pagination(hits) }}
+ {{ search_macros.search_pagination(hits, locale=locale) }}
</div>
</div>
{% endif %}
@@ -136,7 +136,7 @@
{% if hits.count_found > hits.limit %}
<div style="margin-top: 2em; width: 100%;">
<div class="search-pagination">
- {{ search_macros.search_pagination(hits) }}
+ {{ search_macros.search_pagination(hits, locale=locale) }}
</div>
</div>
{% 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 %}
- <span title="{{ biblio.release_date or '' }}">{{ biblio.release_year }}</span>
+ <span title="{{ biblio.release_date or '' }}">{% trans year=biblio.release_year %}{{ year }}{% endtrans %}</span>
{% endif %}
{% if biblio.container_name %}
<i {% if biblio.publisher %}title="{{ biblio.publisher }}"{% endif %}>
@@ -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) -%}
<div class="ui stackable doubling grid">
<div class="thirteen wide column biblio-record">
@@ -487,7 +487,7 @@
</div> {# final row close #}
{% endmacro %}
-{% macro search_pagination(hits, top) %}
+{% macro search_pagination(hits, locale) %}
{% if hits.offset > 0 %}
<button class="text-button" form="search_form" type="submit" name="offset" value="{{ hits.offset - hits.limit }}" style="float: left;" rel="prev">
<a>{% trans %}&laquo; Previous{% endtrans %}</a>
@@ -505,7 +505,9 @@
{% endif %}
<i style="padding-left: 0.5em; padding-right: 0.5em;">
- {% trans trimmed start=(hits.offset + 1), end=(hits.offset + hits.limit), total="{:,}".format(hits.count_found) %}
+ {% trans trimmed start=babel_numbers.format_number(hits.offset + 1, locale=locale),
+ end=babel_numbers.format_number(hits.offset + hits.limit, locale=locale),
+ total=babel_numbers.format_number(hits.count_found, locale=locale) %}
Showing results {{ start }} &mdash; {{ end }} out of {{ total }} results
{% endtrans %}
</i>