diff options
-rw-r--r-- | fatcat_scholar/templates/base.html | 48 | ||||
-rw-r--r-- | fatcat_scholar/templates/search.html | 30 | ||||
-rw-r--r-- | fatcat_scholar/templates/search_macros.html | 82 | ||||
-rw-r--r-- | 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 %} <title> {%- if settings.SCHOLAR_ENV != "prod" -%}[{{ settings.SCHOLAR_ENV|upper }}] {% endif -%} - {%- block title -%}{% trans %}Internet Archive Scholar{% endtrans %}{%- endblock %} </title> <link rel="stylesheet" href="/static/scholar-semantic-ui.v2.4.2.min.css" @@ -80,7 +79,7 @@ </span> <div class="right menu"> - <div class="ui simple dropdown item translate-dropdown" aria-expanded="false" role="menu" aria-controls="language_menu" title="{{ _('language selection menu') }}"> + <div class="ui simple dropdown item translate-dropdown" aria-expanded="false" role="menu" aria-controls="language_menu" title="{{ 'language selection menu' }}"> <div class="translate-icon"></div> <i class="dropdown icon" style="margin-left: 0.2em;"></i> <div id="language_menu" class="menu"> @@ -102,7 +101,7 @@ <a role="menuitem" class="item" href="/ru/">Русский</a> <a role="menuitem" class="item" href="/zh/">中文</a> <div class="divider"></div> - <a class="item" href="https://hosted.weblate.org/projects/internetarchive/fatcat-scholar/">{% trans %}Contribute to translations{% endtrans %}</a> + <a class="item" href="https://hosted.weblate.org/projects/internetarchive/fatcat-scholar/">asdf</a> </div> </div> </div> @@ -125,8 +124,8 @@ <meta itemprop="target" content="/search?q={q}"/> <div class="ui form"> <div class="ui action input large fluid"> - <input type="search" placeholder="{{ _("by title, authors, keywords...") }}" name="q" aria-label="{{ _('search for papers') }}" required itemprop="query-input" style="border-radius: 0; border: 1px #999 solid;" {% if query and query.q %}value="{{ query.q }}"{% endif %}> - <button id="search_submit_button" class="ui green button" style="border-radius: 0; background-color: #44a25a; font-size: 1.2rem;">{{ _("Search") }}</button> + <input type="search" placeholder="{{ "by title, authors, keywords..." }}" name="q" aria-label="{{ 'search for papers' }}" required itemprop="query-input" style="border-radius: 0; border: 1px #999 solid;" {% if query and query.q %}value="{{ query.q }}"{% endif %}> + <button id="search_submit_button" class="ui green button" style="border-radius: 0; background-color: #44a25a; font-size: 1.2rem;">{{ "Search" }}</button> {% if query and query.parsed_q %} <!-- parsed query: {{ query.parsed_q }} --> {% endif %} @@ -141,11 +140,11 @@ {% if query.filter_type %}{% do rss_params.update(dict(filter_type= query.filter_type)) %}{% endif %} {% if query.filter_availability %}{% do rss_params.update(dict(filter_availabilty=query.filter_availability)) %}{% endif %} <a href="{{ lang_prefix }}/feed/rss?{{ rss_params | urlencode }}" rel="nofollow"> - {% trans %}RSS Feed{% endtrans %} + RSS </a> {% endif %} - <a rel="help" href="{{ lang_prefix }}/help" style="order: -1;">{{ _("User Guide") }}</a> + <a rel="help" href="{{ lang_prefix }}/help" style="order: -1;">{{ "User Guide" }}</a> </div> </div> </div> @@ -173,40 +172,33 @@ <div class="thirteen wide twelve wide computer column"> <h4 style="font-size: 1.28571429rem;">Internet Archive</h4> <p style="color: rgba(255, 255, 255, 0.5);"> - {% 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='<a target="_blank" rel="noopener" href="https://web.archive.org">The Wayback Machine</a>'|safe, - archive_org = '<a target="_blank" rel="noopener" href="https://archive.org">archive.org</a>'|safe, - openlibrary = '<a target="_blank" rel="noopener" href="https://openlibrary.org">Open Library</a>'|safe, - archive_it = '<a target="_blank" rel="noopener" href="https://archive-it.org">Archive-It</a>'|safe %} - Other projects include {{ wayback }}, {{ archive_org }}, {{ openlibrary }}, and {{ archive_it }}. - {% endtrans %} <div class="ui horizontal inverted link list"> - <a class="item" target="_blank" rel="noopener" href="https://archive.org/about/">{{ _("About Us") }}</a> - <a class="item" target="_blank" rel="noopener" href="https://archive.org/about/contact.php">{{ _("Contact Us") }}</a> - <a class="item" target="_blank" rel="noopener" href="https://archive.org/about/terms.php">{{ _("Policies") }}</a> - <a class="item" target="_blank" rel="noopener" href="https://archive.org/donate">{{ _("Donate") }}</a> + <a class="item" target="_blank" rel="noopener" href="https://archive.org/about/">{{ "About Us" }}</a> + <a class="item" target="_blank" rel="noopener" href="https://archive.org/about/contact.php">{{ ("Contact Us") }}</a> + <a class="item" target="_blank" rel="noopener" href="https://archive.org/about/terms.php">{{ ("Policies") }}</a> + <a class="item" target="_blank" rel="noopener" href="https://archive.org/donate">{{ ("Donate") }}</a> </div> </div> </div> </nav> <nav class="three wide column"> - <h4 class="ui inverted header">{% trans %}Open Infrastructure{% endtrans %}</h4> + <h4 class="ui inverted header"></h4> <div class="ui inverted link list"> - <a target="_blank" rel="noopener" href="https://fatcat.wiki" class="item">{{ _("Editable Catalog (Fatcat)") }}</a> - <a target="_blank" rel="noopener" href="https://guide.fatcat.wiki" class="item">{{ _("Contribute") }}</a> - <a target="_blank" rel="noopener" href="/api/redoc" class="item">{{ _("Search API") }}</a> - <a target="_blank" rel="noopener noreferrer" href="https://status.fatcat.wiki" class="item">{{ _("Service Status") }}</a> - <a target="_blank" rel="external noopener noreferrer" href="https://github.com/internetarchive/fatcat-scholar" class="item">{{ _("Source Code") }}</a> + <a target="_blank" rel="noopener" href="https://fatcat.wiki" class="item">{{ ("Editable Catalog (Fatcat)") }}</a> + <a target="_blank" rel="noopener" href="https://guide.fatcat.wiki" class="item">{{ ("Contribute") }}</a> + <a target="_blank" rel="noopener" href="/api/redoc" class="item">{{ ("Search API") }}</a> + <a target="_blank" rel="noopener noreferrer" href="https://status.fatcat.wiki" class="item">{{ ("Service Status") }}</a> + <a target="_blank" rel="external noopener noreferrer" href="https://github.com/internetarchive/fatcat-scholar" class="item">{{ ("Source Code") }}</a> </div> </nav> <nav class="three wide column"> <h4 class="ui inverted header">scholar.archive.org</h4> <div class="ui inverted link list"> - <a href="{{ lang_prefix }}/about#howitworks" class="item">{{ _("How It Works") }}</a> - <a href="{{ lang_prefix }}/about#sources" class="item">{{ _("Content Sources") }}</a> - <a href="{{ lang_prefix }}/about#tdm" class="item">{{ _("Text and Data Mining") }}</a> - <a href="{{ lang_prefix }}/help" rel="help" class="item">{{ _("Help") }}</a> + <a href="{{ lang_prefix }}/about#howitworks" class="item">{{ ("How It Works") }}</a> + <a href="{{ lang_prefix }}/about#sources" class="item">{{ ("Content Sources") }}</a> + <a href="{{ lang_prefix }}/about#tdm" class="item">{{ ("Text and Data Mining") }}</a> + <a href="{{ lang_prefix }}/help" rel="help" class="item">{{ ("Help") }}</a> </div> </nav> </div> 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 @@ <div class="tablet-only" style="margin-top: 1.0em;"> <details class="search-filters"> - <summary><i class="filter icon"></i>{{ _("Filters") }}</summary> + <summary><i class="filter icon"></i>{{ "Filters" }}</summary> <div class="tablet-filter-bar"> {{ 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 %} <span class="hit-count" style="font-size: 1.5em;">{{ babel_numbers.format_decimal(hits.count_found, locale=locale) }}</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 %} @@ -74,17 +68,9 @@ <span class="hit-count" style="display: block; font-size: {{ count_size }};"> {{ babel_numbers.format_decimal(hits.count_found, locale=locale) }} </span> - {% 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);"> - {% trans trimmed frac_sec=format_query_time(hits.query_time_ms) %} - in {{ frac_sec }}sec - {% endtrans %} </span> </div> <div class="ui clearing divider"></div> @@ -106,15 +92,8 @@ <i class="ban icon"></i> <div class="content"> <div class="header"> - {% if search_error.type == "backend" %} - {% trans %}Backend Search Engine Error{% endtrans %} - {% elif search_error.type == "query" %} - {% trans %}Search Query Error{% endtrans %} - {% endif %} </div> <p>Computer said: <code>{{ search_error.message }}</code> - <p>{% trans trimmed %}Query parsing is currently very naive. Sometimes you can fix this - problem by adding quotes around terms or entire phrases.{% endtrans %} </div> </div> {% elif hits and hits.results %} @@ -145,25 +124,21 @@ <div class="ui placeholder segment" style="height: 100%;"> <div class="ui icon header"> <i class="search icon"></i> - {% trans %}We didn't find any documents matching your query{% endtrans %} </div> <div class="inline"> {% if query.filter_type != "everything" %} <button class="ui primary button" form="search_form" type="submit" name="filter_type" value="everything"> - {% trans %}Try All Resource Types{% endtrans %} </button> {% endif %} {% if query.filter_time and query.filter_time != "all_time" %} <button class="ui primary button" form="search_form" type="submit" name="filter_time" value="all_time"> - {% trans %}Try All Time{% endtrans %} </button> {% endif %} {% if query.filter_availability != "everything" %} <button class="ui primary button" form="search_form" type="submit" name="filter_availability" value="everything"> - {% trans %}Try Metadata Records{% endtrans %} </button> {% endif %} - <a href="{{ lang_prefix }}/search" class="ui primary button" style="margin: 0.5em;">{{ _("Start Over") }}</a> + <a href="{{ lang_prefix }}/search" class="ui primary button" style="margin: 0.5em;">{{ "Start Over" }}</a> </div> <div class="inline"> <a href="https://archive.org/search.php?sin=TXT&query={{ query.q|urlencode }}" target="_blank" rel="noopener" class="ui button" style="margin: 0.5em;">Try archive.org</a> @@ -176,7 +151,6 @@ <div class="ui placeholder segment" style="height: 100%;"> <div class="ui icon header"> <i class="search icon"></i> - {% trans %}Enter a query in the box above to get started{% endtrans %} </div> </div> {% 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" %} - <span class="ui label basic orange small" title="Open Access">{% trans %}Open Access{% endtrans %}</span> + <span class="ui label basic orange small" title="Open Access"></span> {% elif tag == "jstor" %} <span class="ui label basic purple small" title="Preserved in JSTOR">JSTOR</span> {% elif tag == "scielo" %} @@ -18,12 +18,12 @@ {% elif tag == "doaj" %} <span class="ui label basic orange small" title="Directory of Open Access Journals">DOAJ</span> {% elif tag == "multiple-versions" %} - <span class="ui label basic blue small">{% trans %}Multiple Versions{% endtrans %}</span> + <span class="ui label basic blue small"></span> {% elif tag.startswith("lang:") %} <span class="ui label basic black small" title="ISO Language Code">{{ tag }}</span> {% else %} {# disabling "other" tags for now #} - {# <span class="ui label basic grey small">{{ _(tag) }}</span> #} + {# <span class="ui label basic grey small">{{ (tag) }}</span> #} {% 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 @@ <button class="ui simple right pointing dropdown compact black labeled icon button serp-button"> <i class="icon ia-icon"></i> {% if access.access_type == "wayback" %} - {% trans %}Web Archive{% endtrans %} {% elif access.access_type == "ia_file" %} - {% trans %}File Archive{% endtrans %} {% elif access.access_type == "ia_sim" %} - {% trans %}Archive [Microfilm]{% endtrans %} {% else %} - {% trans %}Other{% endtrans %} {% endif %} {% if access.file_mimetype == "application/pdf" or (access.file_mimetype == None and access.access_type == "wayback") %} - {% trans %}[PDF]{% endtrans %} {% elif access.file_mimetype == "text/html" %} - {% trans %}[HTML]{% endtrans %} {% elif access.file_mimetype == "text/xml" %} - {% trans %}[XML]{% endtrans %} {% endif %} {% if other_version %} @@ -92,7 +85,7 @@ {% if show_thumbnail and access.thumbnail_url %} <div class="menu fulltext-thumbnail"> - <img src="{{ access.thumbnail_url }}" alt="{{ _('fulltext thumbnail') }}" loading="lazy"> + <img src="{{ access.thumbnail_url }}" alt="{{ ('fulltext thumbnail') }}" loading="lazy"> </div> {% endif %} </button> @@ -108,7 +101,7 @@ {% else %} <i class="external alternate icon"></i> {% 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 %} - <span title="{{ biblio.release_date or '' }}">{% trans year=biblio.release_year %}{{ year }}{% endtrans %}</span> + <span title="{{ biblio.release_date or '' }}"></span> {% endif %} {% if biblio.container_name %} <i {% if biblio.publisher %}title="{{ biblio.publisher }}"{% endif %}> @@ -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 %} </span> @@ -210,9 +203,8 @@ {% elif paper.doc_type == "sim_page" %} <span class="link"> - {% 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 %} </span> - <span class="release-type">[{{ _("page") }}]</span> + <span class="release-type">[{{ ("page") }}]</span> {% endif %} </h3> @@ -233,14 +225,13 @@ <div class="dropdown-menu"> {# ### FULLTEXT ACCESS OPTIONS #} <h4 class="ui horizontal divider header"> - {% trans %}Preserved Fulltext{% endtrans %} </h4> {% if paper.fulltext and paper.fulltext.access_url %} <div class="ui items"> <div class="item"> <div class="image"> - <a target="_blank" rel="noopener" href="{{ paper.fulltext.access_url }}" title="{{ _('fulltext access') }}" {% if settings.ENABLE_GOATCOUNTER %}data-goatcounter-click="serp-fulltext" data-goatcounter-title="serp-fulltext"{% endif %}> + <a target="_blank" rel="noopener" href="{{ paper.fulltext.access_url }}" title="{{ ('fulltext access') }}" {% if settings.ENABLE_GOATCOUNTER %}data-goatcounter-click="serp-fulltext" data-goatcounter-title="serp-fulltext"{% endif %}> {% if paper.fulltext.thumbnail_url %} <div class="ui serp card"> <img class="ui" src="{{ paper.fulltext.thumbnail_url }}" alt="fulltext thumbnail" loading="lazy"> @@ -256,11 +247,8 @@ <div class="header"> <a rel="noopener" href="{{ paper.fulltext.access_url }}" {% if settings.ENABLE_GOATCOUNTER %}data-goatcounter-click="serp-fulltext" data-goatcounter-title="serp-fulltext"{% endif %}> {% if paper.fulltext.access_type == "wayback" %} - {% trans %}Web Archive Capture{% endtrans %} {% elif paper.fulltext.access_type == "ia_file" %} - {% trans %}File Archive{% endtrans %} {% elif paper.fulltext.access_type == "ia_sim" %} - {% trans %}Digitized Microfilm{% endtrans %} {% endif %} {% if paper.fulltext.file_mimetype == "application/pdf" or (paper.fulltext.file_mimetype == None and paper.fulltext.access_type == "wayback") %} @@ -285,20 +273,15 @@ {% if paper.fulltext.access_type == "wayback" %} {% set original_url = '/'.join(paper.fulltext.access_url.split('/')[5:]) %} {% set capture_year = paper.fulltext.access_url.split('/')[4][:4] %} - <p>{% trans %}A copy of this work was available on the public web and has been preserved in the Wayback Machine. The capture dates from {{ capture_year }}; you can also visit <a rel="external noopener" href="{{ original_url }}">the original URL</a>.{% endtrans %} {% elif paper.fulltext.access_type == "ia_file" %} - <p>{% trans %}The Internet Archive has a preservation copy of this work in our general collections.{% endtrans %} {% elif paper.fulltext.access_type == "ia_sim" %} - <p>{% trans %}The Internet Archive has digitized a microfilm copy of this work. It may be possible to borrow a copy for reading.{% endtrans %} {% endif %} {% if paper.fulltext.file_mimetype %} - {% trans mimetype = ("<code>" + paper.fulltext.file_mimetype + "</code>")|safe %}The file type is {{ mimetype }}.{% endtrans %} {% endif %} {% if paper.fulltext.release_ident and (paper.biblio.release_ident != paper.fulltext.release_ident) %} {# Fulltext copy is different from biblio version! #} - <p>{% trans %}Note that this fulltext copy is not of the "primary" version of this work. The version it corresponds to is:{% endtrans %} <div class="ui fitted divider"></div> {% for release in paper.releases if release.ident == paper.fulltext.release_ident %} {{ journal_row(release, paper) }} @@ -311,7 +294,6 @@ {# currently, ia_sim access types are not linked to specific versions #} {% for access in paper.access if access.access_type != paper.fulltext.access_type and (access.release_ident == paper.fulltext.release_ident or access.release_ident == paper.biblio.release_ident or access.access_type == 'ia_sim') %} {% if loop.first %} - <p>{% trans %}Additional access options for the primary version of this work:{% endtrans %} {% endif %} {{ ia_access_button(access )}} {% endfor %} @@ -321,10 +303,8 @@ </div> {% else %} {# No fulltext case #} - <p>{% trans %}We don't yet know of a public preservation copy of this work. You may be able to obtain a copy of this work to read from the publisher, platforms, or institutional libraries.{% endtrans %} {% if paper.doc_type == "work" %} {% set save_paper_now_url = "https://fatcat.wiki/release/" + paper.biblio.release_ident + "/save" %} - <p>{% trans %}If you know of a legal, public version that we should archive, please let us know via <a rel="noopener" href="{{ save_paper_now_url }}">"Save Paper Now"</a>.{% endtrans %} {% endif %} {% endif %} @@ -371,7 +351,6 @@ {% if paper.abstracts[0].body|length > 550 %} {{ paper.abstracts[0].body | truncate(500, False, '') }} <details style="display:inline;"> - <summary>{% trans %}more »{% endtrans %}</summary> ... {{ paper.abstracts[0].body[500:] }} </details> {% else %} @@ -393,7 +372,7 @@ </a> {% endif %} - <a rel="noopener" href="{{ lang_prefix }}/help#tags" aria-label="{{ _('tag definitions') }}"> + <a rel="noopener" href="{{ lang_prefix }}/help#tags" aria-label="{{ ('tag definitions') }}"> {% for tag in paper.tags|sort %} {# HACK: don't show "oa" tag if already obvious #} {% if tag != "oa" or ("doaj" not in paper.tags and "szczepanski" not in paper.tags) %} @@ -420,7 +399,7 @@ {# archive links (if available) #} {% if paper.fulltext and paper.fulltext.access_url %} {% if (paper.fulltext.release_ident and paper.fulltext.release_ident != paper.biblio.release_ident) %} - {% set other_version = _("not primary version") %} + {% set other_version = ("not primary version") %} {% else %} {% set other_version = "" %} {% endif %} @@ -437,9 +416,6 @@ {% if paper._collapsed_count and paper._collapsed_count > 0 %} <button class="ui basic compact blue labeled icon button serp-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 %} - Same Issue ({{ count }}) - {% endtrans %} </button> {% endif %} @@ -448,12 +424,11 @@ <details class="serp-action-menu"> <summary> - <div class="circular ui icon compact basic button" title="{{ _('cite this work') }}"> + <div class="circular ui icon compact basic button" title="{{ ('cite this work') }}"> <i class="quote left icon"></i> </div> </summary> <div class="citation-menu menu"> - <b>{% trans %}Citation{% endtrans %}</b> <p>{{ paper._obj.biblio.citation_str("default") }} {% if paper.doc_type == "work" %} <div class="ui divider"></div> @@ -467,13 +442,14 @@ </div> </details> - <a href="https://fatcat.wiki/release/{{ paper.biblio.release_ident }}" rel="noopener" title="{{ _('edit metadata on fatcat wiki') }}"> + <a href="https://fatcat.wiki/release/{{ paper.biblio.release_ident }}" rel="noopener" title="{{ ('edit metadata on fatcat wiki') }}"> + <div class="circular ui icon compact basic button"> <i class="edit icon"></i> </div> </a> - <a href="{{ lang_prefix }}{% if paper.doc_type == "work" %}/work/{{ paper.work_ident }}{% else %}/search?q=key:{{ paper.key }}{% endif %}" rel="noopener" title="{{ _('permalink to this record') }}"> + <a href="{{ lang_prefix }}{% if paper.doc_type == "work" %}/work/{{ paper.work_ident }}{% else %}/search?q=key:{{ paper.key }}{% endif %}" rel="noopener" title="{{ ('permalink to this record') }}"> <div class="circular ui icon compact basic button"> <i class="linkify icon"></i> </div> @@ -489,32 +465,26 @@ {% 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 %}« Previous{% endtrans %}</a> </button> {% else %} - <span style="color:rgba(0,0,0,0.55); float: left">{% trans %}« Previous{% endtrans %}</span> + <span style="color:rgba(0,0,0,0.55); float: left">« </span> {% endif %} {% if hits.offset + hits.limit < hits.count_found %} <button class="text-button" form="search_form" type="submit" name="offset" value="{{ hits.offset + hits.limit }}" style="float: right;" rel="next"> - <a>{% trans %}Next »{% endtrans %}</a> + <a>» </a> </button> {% else %} - <span style="color:rgba(0,0,0,0.55); float: right;">{% trans %}Next »{% endtrans %}</span> + <span style="color:rgba(0,0,0,0.55); float: right;">» </span> {% endif %} <i style="padding-left: 0.5em; padding-right: 0.5em;"> - {% trans trimmed start=babel_numbers.format_decimal(hits.offset + 1, locale=locale), - end=babel_numbers.format_decimal([hits.offset + hits.limit, hits.count_found]|min, locale=locale), - total=babel_numbers.format_decimal(hits.count_found, locale=locale) %} - Showing results {{ start }} — {{ end }} out of {{ total }} results - {% endtrans %} </i> {% endmacro %} {% macro query_option(options, selected) -%} <div> - <label class="filter-label" for="{{ options.slug }}">{{ _(options.label) }}</label> + <label class="filter-label" for="{{ options.slug }}">{{ (options.label) }}</label> <br> <div class="ui link list" style="margin-top: 0.3em;"> {% for opt in options.list %} @@ -524,7 +494,7 @@ {% else %} <span> {% endif %} - {{ _(opt.label) }} + {{ (opt.label) }} </span> </button> <br> @@ -537,7 +507,7 @@ {% macro clear_query(query) -%} {% if query.filter_time or query.filter_type or query.filter_availability or query.sort_order %} <div> - <a class="filter-label" href="{{ lang_prefix }}/search{% if query.q %}?q={{ query.q|urlencode }}{% endif %}" style="color: rgba(0,0,0,0.55); color: brown;">{% trans %}Clear Filters{% endtrans %}</a> + <a class="filter-label" href="{{ lang_prefix }}/search{% if query.q %}?q={{ query.q|urlencode }}{% endif %}" style="color: rgba(0,0,0,0.55); color: brown;"></a> </div> <br> {% endif %} diff --git a/fatcat_scholar/web.py b/fatcat_scholar/web.py index 18299ee..b222eb9 100644 --- a/fatcat_scholar/web.py +++ b/fatcat_scholar/web.py @@ -225,14 +225,15 @@ def load_i18n_templates() -> Any: ) templates = Jinja2Templates( directory="fatcat_scholar/templates", - extensions=["jinja2.ext.i18n", "jinja2.ext.do"], - ) - templates.env.install_gettext_translations(translations, newstyle=True) # type: ignore - templates.env.install_gettext_callables( # type: ignore - locale_gettext(translations), - locale_ngettext(translations), - newstyle=True, + #extensions=["jinja2.ext.i18n", "jinja2.ext.do"], + extensions=["jinja2.ext.do"], ) + #templates.env.install_gettext_translations(translations, newstyle=True) # type: ignore + #templates.env.install_gettext_callables( # type: ignore + # locale_gettext(translations), + # locale_ngettext(translations), + # newstyle=True, + #) # remove a lot of whitespace in HTML output with these configs templates.env.trim_blocks = True templates.env.lstrip_blocks = True |