Support l10n of config strings (#2045)

This commit is contained in:
Jonah Aragon 2023-02-27 12:36:42 -06:00
parent 227609f768
commit f396afa15f
No known key found for this signature in database
13 changed files with 106 additions and 18 deletions

View File

@ -1,5 +1,5 @@
project_id_env: CROWDIN_PROJECT_ID
api_token_env: CROWDIN_PERSONAL_TOKEN
project_id: "509862"
"preserve_hierarchy": true
files:
- source: "/docs/**/*.en.*"

View File

@ -26,16 +26,16 @@ extra:
provider: plausible
property: privacyguides.org
feedback:
title: Was this page helpful?
title: feedback.title
ratings:
- icon: material/robot-happy-outline
name: This page was helpful
name: feedback.helpful.name
data: Helpful
note: Thanks for your feedback!
note: feedback.helpful.note
- icon: material/robot-confused
name: This page could be improved
name: feedback.improve.name
data: Needs Improvement
note: Thanks for your feedback! Help us improve this page by opening a <a href="https://discuss.privacyguides.net/">discussion on our forum</a>.
note: feedback.improve.note
theme:
features:
@ -51,19 +51,19 @@ theme:
accent: deep purple
toggle:
icon: material/brightness-auto
name: Switch to light mode
name: theme.light
- media: "(prefers-color-scheme: dark)"
scheme: slate
accent: amber
toggle:
icon: material/brightness-2
name: Switch to system theme
name: theme.auto
- media: "(prefers-color-scheme: light)"
scheme: default
accent: deep purple
toggle:
icon: material/brightness-5
name: Switch to dark mode
name: theme.dark
watch:
- theme

View File

@ -5,10 +5,6 @@ site_dir: 'site'
site_name: Privacy Guides
site_description: |
Privacy Guides is your central privacy and security resource to protect yourself online.
copyright: |
<b>Privacy Guides</b> is a non-profit, socially motivated website that provides information for protecting your data security and privacy.<br>
We do not make money from recommending certain products, and we do not use affiliate links.<br>
&copy; 2022 Privacy Guides and contributors. <span class="twemoji"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="m245.83 214.87-33.22 17.28c-9.43-19.58-25.24-19.93-27.46-19.93-22.13 0-33.22 14.61-33.22 43.84 0 23.57 9.21 43.84 33.22 43.84 14.47 0 24.65-7.09 30.57-21.26l30.55 15.5c-6.17 11.51-25.69 38.98-65.1 38.98-22.6 0-73.96-10.32-73.96-77.05 0-58.69 43-77.06 72.63-77.06 30.72-.01 52.7 11.95 65.99 35.86zm143.05 0-32.78 17.28c-9.5-19.77-25.72-19.93-27.9-19.93-22.14 0-33.22 14.61-33.22 43.84 0 23.55 9.23 43.84 33.22 43.84 14.45 0 24.65-7.09 30.54-21.26l31 15.5c-2.1 3.75-21.39 38.98-65.09 38.98-22.69 0-73.96-9.87-73.96-77.05 0-58.67 42.97-77.06 72.63-77.06 30.71-.01 52.58 11.95 65.56 35.86zM247.56 8.05C104.74 8.05 0 123.11 0 256.05c0 138.49 113.6 248 247.56 248 129.93 0 248.44-100.87 248.44-248 0-137.87-106.62-248-248.44-248zm.87 450.81c-112.54 0-203.7-93.04-203.7-202.81 0-105.42 85.43-203.27 203.72-203.27 112.53 0 202.82 89.46 202.82 203.26-.01 121.69-99.68 202.82-202.84 202.82z"></path></svg></span><span class="twemoji"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M314.9 194.4v101.4h-28.3v120.5h-77.1V295.9h-28.3V194.4c0-4.4 1.6-8.2 4.6-11.3 3.1-3.1 6.9-4.7 11.3-4.7H299c4.1 0 7.8 1.6 11.1 4.7 3.1 3.2 4.8 6.9 4.8 11.3zm-101.5-63.7c0-23.3 11.5-35 34.5-35s34.5 11.7 34.5 35c0 23-11.5 34.5-34.5 34.5s-34.5-11.5-34.5-34.5zM247.6 8C389.4 8 496 118.1 496 256c0 147.1-118.5 248-248.4 248C113.6 504 0 394.5 0 256 0 123.1 104.7 8 247.6 8zm.8 44.7C130.2 52.7 44.7 150.6 44.7 256c0 109.8 91.2 202.8 203.7 202.8 103.2 0 202.8-81.1 202.8-202.8.1-113.8-90.2-203.3-202.8-203.3z"></path></svg></span><span class="twemoji"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M247.6 8C389.4 8 496 118.1 496 256c0 147.1-118.5 248-248.4 248C113.6 504 0 394.5 0 256 0 123.1 104.7 8 247.6 8zm.8 44.7C130.2 52.7 44.7 150.6 44.7 256c0 109.8 91.2 202.8 203.7 202.8 103.2 0 202.8-81.1 202.8-202.8.1-113.8-90.2-203.3-202.8-203.3zm94 144.3v42.5H162.1V197h180.3zm0 79.8v42.5H162.1v-42.5h180.3z"></path></svg></span> Content licensed under <a href="/about/"><strong>CC BY-ND 4.0</strong></a>.
extra:
social:

View File

@ -1,5 +1,4 @@
{% extends "base.html" %}
{% block extrahead %}
<link rel="preload" href="{{ 'assets/brand/WOFF/bagnard/Bagnard.woff' | url }}" as="font" type="font/woff" crossorigin>
{% endblock %}

View File

@ -1,7 +1,7 @@
{% extends "base.html" %}
{% extends "main.html" %}
{% block extrahead %}
<link rel="preload" href="{{ 'assets/brand/WOFF/bagnard/Bagnard.woff' | url }}" as="font" type="font/woff" crossorigin>
<link rel="stylesheet" href="{{ 'assets/stylesheets/home.css?v=2.10.0' | url }}">
{{ super() }}
{% endblock %}
{% block tabs %}
{{ super() }}

View File

@ -0,0 +1,27 @@
{% macro t(key) %}{{ {
"language": "en",
"site.description": "Privacy Guides is your central privacy and security resource to protect yourself online.",
"theme.light": "Switch to light mode",
"theme.dark": "Switch to dark mode",
"theme.auto": "Switch to system theme",
"feedback.title": "Was this page helpful?",
"feedback.helpful.name": "This page was helpful",
"feedback.helpful.note": "Thanks for your feedback!",
"feedback.improve.name": "This page could be improved",
"feedback.improve.note": "Thanks for your feedback! Help us improve this page by opening a <a href='https://discuss.privacyguides.net/'>discussion on our forum</a>.",
"copyright.intro": "<b>Privacy Guides</b> is a non-profit, socially motivated website that provides information for protecting your data security and privacy.",
"copyright.affiliates": "We do not make money from recommending certain products, and we do not use affiliate links."
}[key] }}{% endmacro %}

View File

@ -0,0 +1,5 @@
{% macro t(key) %}{{ {
"language": "fr"
}[key] }}{% endmacro %}

View File

@ -0,0 +1,5 @@
{% macro t(key) %}{{ {
"language": "he"
}[key] }}{% endmacro %}

View File

@ -0,0 +1,5 @@
{% macro t(key) %}{{ {
"language": "nl"
}[key] }}{% endmacro %}

View File

@ -0,0 +1,39 @@
{% if config.extra.analytics %}
{% set feedback = config.extra.analytics.feedback %}
{% endif %}
{% if page.meta and page.meta.hide %}
{% if "feedback" in page.meta.hide %}
{% set feedback = None %}
{% endif %}
{% endif %}
{% if feedback %}
<form class="md-feedback" name="feedback" hidden>
<fieldset>
<legend class="md-feedback__title">
{{ lang.t(feedback.title) }}
</legend>
<div class="md-feedback__inner">
<div class="md-feedback__list">
{% for rating in feedback.ratings %}
<button class="md-feedback__icon md-icon" type="submit" title="{{ lang.t(rating.name) }}" data-md-value="{{ rating.data }}">
{% include ".icons/" ~ rating.icon ~ ".svg" %}
</button>
{% endfor %}
</div>
<div class="md-feedback__note">
{% for rating in feedback.ratings %}
<div data-md-value="{{ rating.data }}" hidden>
{% set url = "/" ~ page.url %}
{% if page.meta and page.meta.title %}
{% set title = page.meta.title | urlencode %}
{% else %}
{% set title = page.title | urlencode %}
{% endif %}
{{ lang.t(rating.note).format(url = url, title = title) }}
</div>
{% endfor %}
</div>
</div>
</fieldset>
</form>
{% endif %}

View File

@ -1,7 +1,13 @@
<footer class="md-footer">
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
{% include "partials/copyright.html" %}
<div class="md-copyright">
<div class="md-copyright__highlight">
{{ lang.t('copyright.intro') }}<br>
{{ lang.t('copyright.affiliates') }}<br>
&copy; 2022 Privacy Guides and contributors. <span class="twemoji"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="m245.83 214.87-33.22 17.28c-9.43-19.58-25.24-19.93-27.46-19.93-22.13 0-33.22 14.61-33.22 43.84 0 23.57 9.21 43.84 33.22 43.84 14.47 0 24.65-7.09 30.57-21.26l30.55 15.5c-6.17 11.51-25.69 38.98-65.1 38.98-22.6 0-73.96-10.32-73.96-77.05 0-58.69 43-77.06 72.63-77.06 30.72-.01 52.7 11.95 65.99 35.86zm143.05 0-32.78 17.28c-9.5-19.77-25.72-19.93-27.9-19.93-22.14 0-33.22 14.61-33.22 43.84 0 23.55 9.23 43.84 33.22 43.84 14.45 0 24.65-7.09 30.54-21.26l31 15.5c-2.1 3.75-21.39 38.98-65.09 38.98-22.69 0-73.96-9.87-73.96-77.05 0-58.67 42.97-77.06 72.63-77.06 30.71-.01 52.58 11.95 65.56 35.86zM247.56 8.05C104.74 8.05 0 123.11 0 256.05c0 138.49 113.6 248 247.56 248 129.93 0 248.44-100.87 248.44-248 0-137.87-106.62-248-248.44-248zm.87 450.81c-112.54 0-203.7-93.04-203.7-202.81 0-105.42 85.43-203.27 203.72-203.27 112.53 0 202.82 89.46 202.82 203.26-.01 121.69-99.68 202.82-202.84 202.82z"></path></svg></span><span class="twemoji"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M314.9 194.4v101.4h-28.3v120.5h-77.1V295.9h-28.3V194.4c0-4.4 1.6-8.2 4.6-11.3 3.1-3.1 6.9-4.7 11.3-4.7H299c4.1 0 7.8 1.6 11.1 4.7 3.1 3.2 4.8 6.9 4.8 11.3zm-101.5-63.7c0-23.3 11.5-35 34.5-35s34.5 11.7 34.5 35c0 23-11.5 34.5-34.5 34.5s-34.5-11.5-34.5-34.5zM247.6 8C389.4 8 496 118.1 496 256c0 147.1-118.5 248-248.4 248C113.6 504 0 394.5 0 256 0 123.1 104.7 8 247.6 8zm.8 44.7C130.2 52.7 44.7 150.6 44.7 256c0 109.8 91.2 202.8 203.7 202.8 103.2 0 202.8-81.1 202.8-202.8.1-113.8-90.2-203.3-202.8-203.3z"></path></svg></span><span class="twemoji"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M247.6 8C389.4 8 496 118.1 496 256c0 147.1-118.5 248-248.4 248C113.6 504 0 394.5 0 256 0 123.1 104.7 8 247.6 8zm.8 44.7C130.2 52.7 44.7 150.6 44.7 256c0 109.8 91.2 202.8 203.7 202.8 103.2 0 202.8-81.1 202.8-202.8.1-113.8-90.2-203.3-202.8-203.3zm94 144.3v42.5H162.1V197h180.3zm0 79.8v42.5H162.1v-42.5h180.3z"></path></svg></span> <a href="/about/"><strong>CC BY-ND 4.0</strong></a>.
</div>
</div>
{% if config.extra.social %}
{% include "partials/social.html" %}
{% endif %}

View File

@ -46,7 +46,7 @@
{% set accent = option.accent | replace(" ", "-") | lower %}
<input class="md-option" data-md-color-media="{{ option.media }}" data-md-color-scheme="{{ option.scheme }}" data-md-color-primary="{{ primary }}" data-md-color-accent="{{ accent }}" {% if option.toggle %} aria-label="{{ option.toggle.name }}" {% else %} aria-hidden="true" {% endif %} type="radio" name="__palette" id="__palette_{{ loop.index }}">
{% if option.toggle %}
<label class="md-header__button md-icon" title="{{ option.toggle.name }}" for="__palette_{{ loop.index0 or loop.length }}" hidden>
<label class="md-header__button md-icon" title="{{ lang.t(option.toggle.name) }}" for="__palette_{{ loop.index0 or loop.length }}" hidden>
{% include ".icons/" ~ option.toggle.icon ~ ".svg" %}
</label>
{% endif %}

View File

@ -0,0 +1,6 @@
{% import "partials/languages/" ~ config.theme.language ~ ".html" as lang %}
{% import "partials/languages/en.html" as fallback %}
{% import "overrides/strings." ~ config.theme.language ~ ".html" as customlang with context %}
{% import "overrides/strings.en.html" as customfallback %}
{% macro t(key) %}{{ lang.t(key) or fallback.t(key) or customlang.t(key) or customfallback.t(key) or key }}{% endmacro %}