aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-11-05 14:52:43 -0800
committerBryan Newbold <bnewbold@archive.org>2020-11-05 14:55:08 -0800
commite9d9934b2d8a67fbd47816cc3f84f142298cbcfb (patch)
tree46b10a0e610cf4d571e856a9b14a5ba101c47426
parent2b99551390d574d7518b67731c77937422c845f9 (diff)
downloadfatcat-scholar-e9d9934b2d8a67fbd47816cc3f84f142298cbcfb.tar.gz
fatcat-scholar-e9d9934b2d8a67fbd47816cc3f84f142298cbcfb.zip
pluralize result and 'additional' strings (for i18n)
Thanks to Mito Ivir on weblate for the recommendation.
-rw-r--r--fatcat_scholar/templates/search.html28
-rw-r--r--fatcat_scholar/templates/search_macros.html4
2 files changed, 25 insertions, 7 deletions
diff --git a/fatcat_scholar/templates/search.html b/fatcat_scholar/templates/search.html
index 27b1676..d91b78a 100644
--- a/fatcat_scholar/templates/search.html
+++ b/fatcat_scholar/templates/search.html
@@ -3,9 +3,9 @@
{% macro format_query_time(query_time_ms) -%}
{% if query_time_ms >= 10000 %}
- {{ "{:0.3}".format(hits.query_time_ms/1000.0) }}sec
+ {{ "{:0.3}".format(hits.query_time_ms/1000.0) }}
{% else %}
- {{ "{:0.2}".format(hits.query_time_ms/1000.0) }}sec
+ {{ "{:0.2}".format(hits.query_time_ms/1000.0) }}
{% endif %}
{%- endmacro %}
@@ -43,8 +43,16 @@
{% if hits %}
<span class="hit-count" style="font-size: 1.5em;">{{ "{:,}".format(hits.count_found) }}</span>
- Hits
- <span style="color: rgba(0,0,0,0.55);">in {{ format_query_time(hits.query_time_ms) }}</span>
+ {% trans trimmed count=hits.count_found %}
+ Hit
+ {% pluralize %}
+ Hits
+ {% endtrans %}
+ <span style="color: rgba(0,0,0,0.55);">
+ {% trans trimmed frac_sec=format_query_time(hits.query_time_ms) %}
+ in {{ frac_sec }}sec
+ {% endtrans %}
+ </span>
{% else %}
&nbsp;
{% endif %}
@@ -65,10 +73,18 @@
<span class="hit-count" style="display: block; font-size: {{ count_size }};">
{{ "{:,}".format(hits.count_found) }}
</span>
- {{ _("Hits") }}
+ {% trans trimmed count=hits.count_found %}
+ Hit
+ {% pluralize %}
+ Hits
+ {% endtrans %}
</div>
<div style="text-align: end;">
- <span style="color: rgba(0,0,0,0.55);">in {{ format_query_time(hits.query_time_ms) }}</span>
+ <span style="color: rgba(0,0,0,0.55);">
+ {% trans trimmed frac_sec=format_query_time(hits.query_time_ms) %}
+ in {{ frac_sec }}sec
+ {% endtrans %}
+ </span>
</div>
<div class="ui clearing divider"></div>
{% endif %}
diff --git a/fatcat_scholar/templates/search_macros.html b/fatcat_scholar/templates/search_macros.html
index 879f96a..0c35dd4 100644
--- a/fatcat_scholar/templates/search_macros.html
+++ b/fatcat_scholar/templates/search_macros.html
@@ -252,7 +252,9 @@
<button class="ui basic label blue small button" form="search_form" type="submit" name="collapse_key" value="{{ paper.collapse_key }}">
<i class="ui icon zoom-in"></i>
{% trans trimmed count=paper._collapsed_count %}
- Show {{ count }} additional hits from this issue
+ Show {{ count }} additional result from this issue
+ {% pluralize %}
+ Show {{ count }} additional results from this issue
{% endtrans %}
</button>
{% endif %}