From eabe736fc0379137d39baa303b0b695aa82439ad Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 12 Aug 2022 11:07:18 -0700 Subject: DEBUG: remove jinja2.i18n from SERP --- fatcat_scholar/templates/base.html | 48 +++++++---------- fatcat_scholar/templates/search.html | 30 +---------- fatcat_scholar/templates/search_macros.html | 82 +++++++++-------------------- fatcat_scholar/web.py | 15 +++--- 4 files changed, 56 insertions(+), 119 deletions(-) diff --git a/fatcat_scholar/templates/base.html b/fatcat_scholar/templates/base.html index 1abc216..a92525e 100644 --- a/fatcat_scholar/templates/base.html +++ b/fatcat_scholar/templates/base.html @@ -10,7 +10,6 @@ {%- endif %} {%- if settings.SCHOLAR_ENV != "prod" -%}[{{ settings.SCHOLAR_ENV|upper }}] {% endif -%} - {%- block title -%}{% trans %}Internet Archive Scholar{% endtrans %}{%- endblock %} @@ -173,40 +172,33 @@

Internet Archive

- {% trans %}We are a US 501(c)(3) non-profit library, building a global archive of Internet sites and other cultural artifacts in digital form.{% endtrans %} - {% trans trimmed wayback='The Wayback Machine'|safe, - archive_org = 'archive.org'|safe, - openlibrary = 'Open Library'|safe, - archive_it = 'Archive-It'|safe %} - Other projects include {{ wayback }}, {{ archive_org }}, {{ openlibrary }}, and {{ archive_it }}. - {% endtrans %}

diff --git a/fatcat_scholar/templates/search.html b/fatcat_scholar/templates/search.html index 3adaf2f..2bccaaf 100644 --- a/fatcat_scholar/templates/search.html +++ b/fatcat_scholar/templates/search.html @@ -32,7 +32,7 @@
- {{ _("Filters") }} + {{ "Filters" }}
{{ search_macros.query_option(query.time_options, query.filter_time) }} {{ search_macros.query_option(query.type_options, query.filter_type) }} @@ -44,15 +44,9 @@ {% if hits %} {{ babel_numbers.format_decimal(hits.count_found, locale=locale) }} - {% trans trimmed count=hits.count_found %} Hit - {% pluralize %} Hits - {% endtrans %} - {% trans trimmed frac_sec=format_query_time(hits.query_time_ms) %} - in {{ frac_sec }}sec - {% endtrans %} {% else %}   @@ -74,17 +68,9 @@ {{ babel_numbers.format_decimal(hits.count_found, locale=locale) }} - {% trans trimmed count=hits.count_found %} - Hit - {% pluralize %} - Hits - {% endtrans %}
- {% trans trimmed frac_sec=format_query_time(hits.query_time_ms) %} - in {{ frac_sec }}sec - {% endtrans %}
@@ -106,15 +92,8 @@
- {% if search_error.type == "backend" %} - {% trans %}Backend Search Engine Error{% endtrans %} - {% elif search_error.type == "query" %} - {% trans %}Search Query Error{% endtrans %} - {% endif %}

Computer said: {{ search_error.message }} -

{% trans trimmed %}Query parsing is currently very naive. Sometimes you can fix this - problem by adding quotes around terms or entire phrases.{% endtrans %}

{% elif hits and hits.results %} @@ -145,25 +124,21 @@
- {% trans %}We didn't find any documents matching your query{% endtrans %}
{% if query.filter_type != "everything" %} {% endif %} {% if query.filter_time and query.filter_time != "all_time" %} {% endif %} {% if query.filter_availability != "everything" %} {% endif %} - {{ _("Start Over") }} + {{ "Start Over" }}
Try archive.org @@ -176,7 +151,6 @@
- {% trans %}Enter a query in the box above to get started{% endtrans %}
{% endif %} diff --git a/fatcat_scholar/templates/search_macros.html b/fatcat_scholar/templates/search_macros.html index 1b331bc..1e7a07f 100644 --- a/fatcat_scholar/templates/search_macros.html +++ b/fatcat_scholar/templates/search_macros.html @@ -1,7 +1,7 @@ {% macro tag_label(tag) -%} {% if tag == "oa" %} - {% trans %}Open Access{% endtrans %} + {% elif tag == "jstor" %} JSTOR {% elif tag == "scielo" %} @@ -18,12 +18,12 @@ {% elif tag == "doaj" %} DOAJ {% elif tag == "multiple-versions" %} - {% trans %}Multiple Versions{% endtrans %} + {% elif tag.startswith("lang:") %} {{ tag }} {% else %} {# disabling "other" tags for now #} - {# {{ _(tag) }} #} + {# {{ (tag) }} #} {% endif %} {% endmacro %} @@ -56,11 +56,11 @@ {% macro ia_access_button(access, show_thumbnail=False, other_version=False) -%} {% if access.file_mimetype == "application/pdf" %} - {% set access_alt = _('fulltext PDF download') %} + {% set access_alt = ('fulltext PDF download') %} {% elif access.access_type == "ia_sim" %} - {% set access_alt = _('read fulltext microfilm') %} + {% set access_alt = ('read fulltext microfilm') %} {% else %} - {% set access_alt = _('fulltext access') %} + {% set access_alt = ('fulltext access') %} {% endif %} {% if other_version %} {% set access_alt = access_alt + " [" + other_version + "]" %} @@ -69,21 +69,14 @@ @@ -108,7 +101,7 @@ {% else %} {% endif %} - {% set default_domain = _("Publisher / doi.org") %} + {% set default_domain = ("Publisher / doi.org") %} {% if paper._obj and paper._obj.biblio %} {{ paper._obj.biblio.doi_link_domain(default_domain) }} {% else %} @@ -141,7 +134,7 @@ {% macro journal_row(biblio, paper) -%} {# NOTE: should be able to call with paper.biblio or any paper.release[] #} {% if biblio.release_year %} - {% trans year=biblio.release_year %}{{ year }}{% endtrans %} + {% endif %} {% if biblio.container_name %} @@ -192,11 +185,11 @@ {% if paper.biblio.release_type in ("article-journal", "paper-conference") or paper.doc_type == "sim_page" %} {# pass #} {% elif paper.biblio.release_type in ("book", "chapter", "dataset") %} - [{{ _(paper.biblio.release_type) }}] + [{{ (paper.biblio.release_type) }}] {% elif not paper.biblio.release_type %} - [{{ _("unknown") }}] + [{{ ("unknown") }}] {% else %} - [{{ _(paper.biblio.release_type) }}] + [{{ (paper.biblio.release_type) }}] {% endif %} @@ -210,9 +203,8 @@ {% elif paper.doc_type == "sim_page" %} - {% trans page_num = paper.ia_sim.first_page, journal_name = paper.biblio.container_name, volume = paper.biblio.volume, issue = paper.biblio.issue %}Page {{ page_num }} of {{ journal_name }} Vol. {{ volume }}, Issue {{ issue }}{% endtrans %} - [{{ _("page") }}] + [{{ ("page") }}] {% endif %} @@ -233,14 +225,13 @@