From 4337afe1c2ea158bbfac7ef8d47a8bd795b6419b Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Mon, 7 Jun 2021 11:44:04 -0700 Subject: [PATCH] localization: wrap more text strings in templates docs: fix typos in docs, mention html lang setting --- docs/manual/localization.rst | 6 ++-- pywb/templates/error.html | 12 ++++---- pywb/templates/index.html | 2 +- pywb/templates/not_found.html | 4 +-- pywb/templates/search.html | 56 +++++++++++++++++------------------ 5 files changed, 41 insertions(+), 39 deletions(-) diff --git a/docs/manual/localization.rst b/docs/manual/localization.rst index d1616e576..c137fb07d 100644 --- a/docs/manual/localization.rst +++ b/docs/manual/localization.rst @@ -7,7 +7,7 @@ pywb supports configuring different language locales and loading different langu pywb can extract all text from templates and generate CSV files for translation and convert them back into a binary format used for localization/internationalization. -(pywb uses the `Babel library `_ which extends the `standard Python i18n system `_ +(pywb uses the `Babel library `_ which extends the `standard Python i18n system `_) Locales to use are configured in the ``config.yaml``. @@ -83,7 +83,9 @@ pywb can be configured with a default, single-language locale, by setting the `` - es -With this configuration, pywb will automatically use the ``es`` locale for all text strings. +With this configuration, pywb will automatically use the ``es`` locale for all text strings in pywb pages. + +pywb will also set the ```` so that the browser will recognize the correct locale. Mutli-language Translations diff --git a/pywb/templates/error.html b/pywb/templates/error.html index c0745395c..9b2f22975 100644 --- a/pywb/templates/error.html +++ b/pywb/templates/error.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% block title %}Pywb Error{% endblock %} +{% block title %}{{ _('Pywb Error') }}{% endblock %} {% block body %}
@@ -8,22 +8,22 @@

Pywb Error

{% if err_status == 451 %} -

Access Blocked to {{ err_msg }}

+

{% trans %}Access Blocked to {{ err_msg }}{% endtrans %}

{% elif err_status == 404 and err_details == 'coll_not_found' %} -

Collection not found: {{ err_msg }}

+

{% trans %}Collection not found: {{ err_msg }}{% endtrans %}

-

See list of valid collections

+

{{ _('See list of valid collections') }}

{% elif err_status == 404 and err_details == 'static_file_not_found' %} -

Static file not found: {{ err_msg }}

+

{% trans %}Static file not found: {{ err_msg }}{% endtrans %}

{% else %}

{{ err_msg }}

{% if err_details %} -

Error Details:

+

{% trans %}Error Details:{% endtrans %}

{{ err_details }}
{% endif %} {% endif %} diff --git a/pywb/templates/index.html b/pywb/templates/index.html index 9157368bc..338232a3f 100644 --- a/pywb/templates/index.html +++ b/pywb/templates/index.html @@ -3,7 +3,7 @@

{{ _('Pywb Wayback Machine') }}

-

This archive contains the following collections:

+

{{ _('This archive contains the following collections:') }}

    diff --git a/pywb/templates/not_found.html b/pywb/templates/not_found.html index 727cbdf71..89e671d0d 100644 --- a/pywb/templates/not_found.html +++ b/pywb/templates/not_found.html @@ -1,6 +1,6 @@ {% extends "base.html" %} -{% block title %}URL Not Found{% endblock %} +{% block title %}{{ _('URL Not Found') }}{% endblock %} {% block body %}
    @@ -13,7 +13,7 @@

    {% trans %}URL Not Found{% endtrans %}

    {% if wbrequest and wbrequest.env.pywb_proxy_magic and url %}

    - Try Different Collection + {{ _('Try Different Collection') }}

    {% endif %} diff --git a/pywb/templates/search.html b/pywb/templates/search.html index f5a1407c6..c0980abe4 100644 --- a/pywb/templates/search.html +++ b/pywb/templates/search.html @@ -29,7 +29,7 @@

    name="search" placeholder="Enter a URL to search for" title="{{ _('Enter a URL to search for') }}" type="search" required/>
    - {{ _('Please enter a URL') }} + {% trans %}'Please enter a URL{% endtrans %}

@@ -54,44 +54,44 @@

- Date/Time Range + {{ _('Date/Time Range') }}

- +
-
From:
+
{% trans %}From:{% endtrans %}
- Please enter a valid From timestamp. Timestamps may be 4 <= ts <=14 digits + {% trans %}Please enter a valid From timestamp. Timestamps may be 4 <= ts <=14 digits{% endtrans %}
- +
-
To:
+
{% trans %}To:{% endtrans %}
- Please enter a valid To timestamp. Timestamps may be 4 <= ts <=14 digits + {% trans %}Please enter a valid To timestamp. Timestamps may be 4 <= ts <=14 digits{% endtrans %}
@@ -99,41 +99,41 @@

-

Filtering

+

{% trans %}Filtering{% endtrans %}

- +
- +
- + @@ -141,7 +141,7 @@

    -
  • No Filter
  • +
  • {% trans %}No Filter{% endtrans %}