From 2ec0dfcdefb954d9232a0025cafbf1cc426ae7c2 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 3 Apr 2020 12:43:13 -0700 Subject: UI tweaks, i18n prep --- fatcat_covid19/templates/400.html | 7 +- fatcat_covid19/templates/404.html | 2 +- fatcat_covid19/templates/500.html | 9 +- fatcat_covid19/templates/about_de.html | 6 +- fatcat_covid19/templates/about_en.html | 6 +- fatcat_covid19/templates/about_zh.html | 11 +++ fatcat_covid19/templates/base.html | 19 ++-- fatcat_covid19/templates/entity_macros.html | 82 ++++++++++++++---- fatcat_covid19/templates/fulltext_search.html | 25 +++--- fatcat_covid19/templates/sources.html | 119 -------------------------- fatcat_covid19/templates/sources_de.html | 11 +++ fatcat_covid19/templates/sources_en.html | 11 +++ fatcat_covid19/templates/sources_zh.html | 11 +++ fatcat_covid19/webface.py | 8 +- 14 files changed, 155 insertions(+), 172 deletions(-) create mode 100644 fatcat_covid19/templates/about_zh.html delete mode 100644 fatcat_covid19/templates/sources.html create mode 100644 fatcat_covid19/templates/sources_de.html create mode 100644 fatcat_covid19/templates/sources_en.html create mode 100644 fatcat_covid19/templates/sources_zh.html (limited to 'fatcat_covid19') diff --git a/fatcat_covid19/templates/400.html b/fatcat_covid19/templates/400.html index f2659ca..7b6598c 100644 --- a/fatcat_covid19/templates/400.html +++ b/fatcat_covid19/templates/400.html @@ -3,11 +3,12 @@
400
-
Bad Request
+
{{ _("Bad Request") }}
-

Wasn't able to handle the request, either due to incorrect or unexpected +

+{{ _("Wasn't able to handle the request, either due to incorrect or unexpected input. Usually more context should be available; if you hit this page it means -you've discovered a new corner case! +you've discovered a new corner case!") }}

{% endblock %} diff --git a/fatcat_covid19/templates/404.html b/fatcat_covid19/templates/404.html index 653b8ee..89c9189 100644 --- a/fatcat_covid19/templates/404.html +++ b/fatcat_covid19/templates/404.html @@ -3,7 +3,7 @@
404
-
Not Found
+
{{ _("Not Found") }}
{% endblock %} diff --git a/fatcat_covid19/templates/500.html b/fatcat_covid19/templates/500.html index a99232c..e42ba4e 100644 --- a/fatcat_covid19/templates/500.html +++ b/fatcat_covid19/templates/500.html @@ -3,11 +3,12 @@
500
-
Internal Error
+
{{ _("Internal Error") }}
-

Hrm, something unexpected went wrong. You may have found a bug! This request -should be logged and reported automatically; you could re-try or contact us for -more info. +

+{{ _("Hrm, something unexpected went wrong. You may have found a bug! This +request should be logged and reported automatically; you could re-try or +contact us for more info.") }}

{% endblock %} diff --git a/fatcat_covid19/templates/about_de.html b/fatcat_covid19/templates/about_de.html index 2dd2b5e..8db4a6f 100644 --- a/fatcat_covid19/templates/about_de.html +++ b/fatcat_covid19/templates/about_de.html @@ -1,12 +1,10 @@ {% extends "base.html" %} -{% block title %}About{% endblock %} +{% block title %}{{ _("About") }}{% endblock %} {% block body %} -{# #} - -

+

About Fatcat COVID-19 Paper Search

TODO diff --git a/fatcat_covid19/templates/about_en.html b/fatcat_covid19/templates/about_en.html index 2dd2b5e..8db4a6f 100644 --- a/fatcat_covid19/templates/about_en.html +++ b/fatcat_covid19/templates/about_en.html @@ -1,12 +1,10 @@ {% extends "base.html" %} -{% block title %}About{% endblock %} +{% block title %}{{ _("About") }}{% endblock %} {% block body %} -{# #} - -

+

About Fatcat COVID-19 Paper Search

TODO diff --git a/fatcat_covid19/templates/about_zh.html b/fatcat_covid19/templates/about_zh.html new file mode 100644 index 0000000..8db4a6f --- /dev/null +++ b/fatcat_covid19/templates/about_zh.html @@ -0,0 +1,11 @@ +{% extends "base.html" %} + +{% block title %}{{ _("About") }}{% endblock %} + +{% block body %} + +

About Fatcat COVID-19 Paper Search

+ +TODO + +{% endblock %} diff --git a/fatcat_covid19/templates/base.html b/fatcat_covid19/templates/base.html index 3193619..d2ce02e 100644 --- a/fatcat_covid19/templates/base.html +++ b/fatcat_covid19/templates/base.html @@ -32,13 +32,14 @@ fatcat  [COVID-19] - About + {{ _("About") }} + {{ _("Sources") }} @@ -103,9 +104,9 @@
diff --git a/fatcat_covid19/templates/entity_macros.html b/fatcat_covid19/templates/entity_macros.html index cc3a8a6..1c4177c 100644 --- a/fatcat_covid19/templates/entity_macros.html +++ b/fatcat_covid19/templates/entity_macros.html @@ -14,7 +14,11 @@ - {% if paper.title %} + {% if g.lang_code != 'en' and g.lang_code == paper.lang and paper.original_title %} + {# show original title first instead of title if UI is in that language #} + {{ paper.original_title[:512] }} + {% if paper.original_title|length > 512 %}...{% endif %} + {% elif paper.title %} {{ paper.title[:512] }} {% if paper.title|length > 512 %}...{% endif %} {% else %} @@ -22,15 +26,30 @@ {% endif %} + {# release type suffix #} {% if paper.release_type in ("article-journal", "paper-conference") %} {# pass #} {% elif paper.release_type in ("book", "chapter", "dataset") %} - [{{ paper.release_type }}] + [{{ _(paper.release_type) }}] {% elif not paper.release_type %} [media?] {% else %} - [{{ paper.release_type }}] + [{{ _(paper.release_type) }}] {% endif %} + + {# show inverse of title/original_title above #} + {% if g.lang_code != 'en' and g.lang_code == paper.lang and paper.title and paper.title != paper.original_title %} +
+ + {{ paper.title[:512] }} {% if paper.title|length > 512 %}...{% endif %} + + {% elif paper.original_title and paper.title != paper.original_title %} +
+ + {{ paper.original_title[:512] }} {% if paper.original_title|length > 512 %}...{% endif %} + + {% endif %} + {# @@ -83,44 +102,77 @@ {# ### ABSTRACT / QUERY HIGHLIGHT #} {% if paper._highlights %} -
+
{% for highlight in paper._highlights %} {{ highlight|safe }} ... {% endfor %}
{% elif paper.abstract %} -
+
{% if paper.abstract[0]|length > 500 %} {{ paper.abstract[0][:500] }}... {% else %} {{ paper.abstract[0][:500] }}... {% endif %}
+ {% else %} +
{% endif %} {# ### IDENTIFIERS #} - {% if paper.doi or paper.pmid or paper.arxiv_id or paper.jstor_id %} -
- {% endif %} {% if paper.doi %} doi:{{ paper.doi }}   {% endif %} {% if paper.pmid %} pmid:{{ paper.pmid }}   {% endif %} + {% if paper.pmcid %} + pmcid:{{ paper.pmcid }}   + {% endif %} {% if paper.arxiv_id %} arXiv:{{ paper.arxiv_id }}   {% endif %} - {% if False %} {# XXX: elastic release work grouping searches #} -
- and 5 other versions of the same work! + {% if paper.fatcat_ident %} + fatcat:{{ paper.fatcat_ident}}   {% endif %} + + {# ### SOURCE TAGS #} +
+ {% if paper.cord19_uid or 'cord19' in paper.source_tags %} + + CORD-19 + + {% endif %} + {% if 'fatcat' in paper.source_tags %} + + fatcat + + {% endif %} + {% if 'who' in paper.source_tags %} + + WHO + + {% endif %} + {% if 'wanfang' in paper.source_tags %} + + Wanfang + + {% endif %} + {% if 'cnki' in paper.source_tags %} + + CNKI + + {% endif %} + {# olive, brown, grey, pink, red, etc #} +
+
{% if paper.fulltext.thumbnail_url %} +
{% else %} {# No Fulltext #} {% endif %} @@ -149,12 +201,12 @@ {% if found.offset > 0 %} {% if found.offset - found.limit < 0 %} - « Previous + « {{ _("Previous") }} {% else %} - « Previous + « {{ _("Previous") }} {% endif %} {% else %} - « Previous + « {{ _("Previous") }} {% endif %}   Showing results {{ found.offset }} — {{ found.offset + @@ -163,7 +215,7 @@ found.count_returned }} out of {{ found.count_found }} results   {% if found.offset + found.limit < found.count_found and found.offset + found.limit < found.deep_page_limit %} Next » {% else %} - Next » + {{ _("Next") }} » {% endif %} {%- endmacro %} diff --git a/fatcat_covid19/templates/fulltext_search.html b/fatcat_covid19/templates/fulltext_search.html index d2a8e4c..d6367a8 100644 --- a/fatcat_covid19/templates/fulltext_search.html +++ b/fatcat_covid19/templates/fulltext_search.html @@ -3,9 +3,9 @@ {% block title %} {% if query %} - Search: {{ query }} + {{ _("Search") }}: {{ query }} {% else %} - Fulltext Search + {{ _("Fulltext Search") }} {% endif %} {% endblock %} @@ -19,13 +19,15 @@
- +
+ {#

Can also lookup by identifier or search for containers (eg, journals). + #}
@@ -58,22 +60,23 @@ {# "did a query, but no results" #}

- Raw query was: {{ found.query.q }} + {{ _("Raw query was:") }} {{ found.query.q }}
- {# +

{{ _("No results found!") }}

+
+
confused paper man
- #}
-

No results found!

-

You could try elsewhere:

+
+

{{ _("Try searching elsewhere") }}:

diff --git a/fatcat_covid19/templates/sources.html b/fatcat_covid19/templates/sources.html deleted file mode 100644 index 17b0818..0000000 --- a/fatcat_covid19/templates/sources.html +++ /dev/null @@ -1,119 +0,0 @@ -{% extends "base.html" %} - -{% block title %}About{% endblock %} - -{% block body %} - -{# #} - -

- -

Fatcat is versioned, publicly-editable catalog of research publications: -journal articles, conference proceedings, pre-prints, blog posts, and so forth. -The goal is to improve the state of preservation and access to these works by -providing a manifest of full-text content versions and locations. - -

This service does not directly contain full-text content itself, but -provides basic access for human and machine readers through links to copies in -web archives, repositories, and the public web. - -

Significantly more context and background information can be found in The Guide. - -

Feedback and queries can be directed to -webservices@archive.org. - -

Goals and Features

- -

A few things set Fatcat apart from similar indexing and discovery services: - -

    -
  • inclusion of archival, file-level metadata (hashes) in addition - to URLs, which allows automated verification ("do I have the right copy"), - reveals content-drift over time, and enables efficient distribution of - content through the ecosystem -
  • native support for "post-PDF" digital media, including archival web - captures and datasets, as well as content stored on the distributed web -
  • data model that captures the work/edition distinction, - grouping pre-print, post-review, published, re-published, and updated - versions of a work together -
  • public editing interface, allowing metadata corrections and improvements - from individuals and bots in addition to automated imports from authoritative - sources -
  • focus on providing a stable API and corpus (making integration with - diverse user-facing applications simple), while enabling full replication and - mirroring of the corpus to reduce the risks of centralized control -
- -

This service aspires to be a piece of sustainable, long-term, non-profit, -free-software, collaborative, open digital infrastructure. It is primarily -designed to support the archival and dissemination roles of -scholarly communication. It may also support the registration role -(establishing precedence and authorship), but explicitly does not aid with -certification of content, and is not intended to be used for -evaluation of individuals, institutions, or venues. This service is -"universal", not currated, and happily includes retracted and "predatory" -content). - -

Sources of Metadata

- -The source of all bibliographic information is recorded in edit history -metadata, which allows the provenance of all records to be reconstructed. A few -major sources are worth highlighting here: - -
    -
  • Release metadata from Crossref, via their public - REST API -
  • Release metadata and linked full-text content from NIH Pubmed and arXiv.org -
  • Release metadata and linked public domain full-text content the JSTOR Early Journal Content collection -
  • Creator names and de-duplication from ORCID, via their annual public data releases -
  • Journal title metadata from DOAJ, ISSN ROAD, and SHERPA/RoMEO -
  • Full-text URL lists from CORE, - Unpaywall, - Semantic Scholar, - CiteseerX, - and Microsoft Academic Graph. -
  • The Guide lists more major sources -
- -Many thanks for the hard work of all these projects, institutions, and -individuals! - - -

Support and Acknowledgments

- -

Fatcat is a project of the Internet Archive, -a US-based non-profit digital library, well known for its -Wayback Machine web archive and -Open Library book digitization and -lending service. All Fatcat databases and services run on Internet Archive -servers in California, and a copy of most full-text content is stored in the -Archive's collections and/or web archives. - -

Development of Fatcat and related web harvesting, indexing, and preservation -efforts at the Archive have been partially funded (for the 2018-2019 period) by -a generous grant from the Mellon Foundation -("Long-tail Open Access Journal Preservation"). -Fatcat supports this work by both tracking which open access works in known -archives and providing minimum-viable indexing and access mechanisms for -long-tail works which otherwise would lack them. - -

The service would not technically be possible without hundreds of Free -Software components and the efforts of their individual and organizational -maintainers, more than can be listed here (please see the source code for full -lists). A few major components include the PostgreSQL database, Elasticsearch -search engine, Flask python web framework, Rust programming language, Diesel -database library, Swagger/OpenAPI code generators, Kafka distributed log, -Ansible configuration management tool, and Ubuntu GNU/Linux operating system -distribution. - -

The front-page photo of a large feline with a cup of coffee is by -Quinn Kampschroer, -under a CC-0 license. The name "Fatcat" can be interpreted as short for "large -catalog", as the service aspires to be a complete catalog of the digital -scholarly record. - -

A list of technical contributors, including volunteers, is maintained in the -source code repository (CONTRIBUTORS.md). Thanks everybody! - -{% endblock %} diff --git a/fatcat_covid19/templates/sources_de.html b/fatcat_covid19/templates/sources_de.html new file mode 100644 index 0000000..67f2975 --- /dev/null +++ b/fatcat_covid19/templates/sources_de.html @@ -0,0 +1,11 @@ +{% extends "base.html" %} + +{% block title %}{{ _("Content Sources") }}{% endblock %} + +{% block body %} + +

{{ _("Content Sources") }}

+ +TODO + +{% endblock %} diff --git a/fatcat_covid19/templates/sources_en.html b/fatcat_covid19/templates/sources_en.html new file mode 100644 index 0000000..d46ac77 --- /dev/null +++ b/fatcat_covid19/templates/sources_en.html @@ -0,0 +1,11 @@ +{% extends "base.html" %} + +{% block title %}{{ _("Content Sources") }}{% endblock %} + +{% block body %} + +

{{ _("Sources of Content and Metadata") }}

+ +TODO + +{% endblock %} diff --git a/fatcat_covid19/templates/sources_zh.html b/fatcat_covid19/templates/sources_zh.html new file mode 100644 index 0000000..d46ac77 --- /dev/null +++ b/fatcat_covid19/templates/sources_zh.html @@ -0,0 +1,11 @@ +{% extends "base.html" %} + +{% block title %}{{ _("Content Sources") }}{% endblock %} + +{% block body %} + +

{{ _("Sources of Content and Metadata") }}

+ +TODO + +{% endblock %} diff --git a/fatcat_covid19/webface.py b/fatcat_covid19/webface.py index 12ccac5..d645cb5 100644 --- a/fatcat_covid19/webface.py +++ b/fatcat_covid19/webface.py @@ -16,7 +16,11 @@ from sentry_sdk.integrations.flask import FlaskIntegration class BaseConfig(object): - SUPPORTED_LANGUAGES = {'en': 'English', 'de': 'Deutsch'} + SUPPORTED_LANGUAGES = { + 'en': 'English', + 'de': 'Deutsch', + 'zh': '中文', + } BABEL_DEFAULT_LOCALE = 'en' BABEL_DEFAULT_TIMEZONE = 'UTC' GIT_REVISION = subprocess.check_output(["git", "describe", "--always"]).strip().decode('utf-8') @@ -86,7 +90,7 @@ def page_about(): @bp.route('/sources', methods=['GET']) def page_sources(): - return render_template('sources.html') + return render_template('sources_{}.html'.format(g.lang_code)) @bp.errorhandler(404) -- cgit v1.2.3