From c36002d85192a38ddc4418f477996d8f9fabb3f3 Mon Sep 17 00:00:00 2001 From: djoate <56777051+djoate@users.noreply.github.com> Date: Mon, 18 Nov 2019 00:09:19 +0000 Subject: [PATCH 01/16] Add jekyll-simple-i18n plugin with example Adds in support for https://github.com/signalapp/jekyll-simple-i18n. The plugin did not work with the github-pages gem, so github-pages was switched with jekyll (which is what the current i18n branch does anyway). --- .gitignore | 1 + Gemfile | 3 +- Gemfile.lock | 194 +------------------------- _config.yml | 3 +- _data/language_map.yml | 47 +++++++ _data/languages/en.yml | 13 ++ _data/languages/es.yml | 13 ++ _plugins/hreflang-tag.rb | 35 +++++ _plugins/translate-tag.rb | 38 +++++ _plugins/translated-page-generator.rb | 47 +++++++ _plugins/weblate-source-file.rb | 49 +++++++ index.html | 5 +- 12 files changed, 256 insertions(+), 192 deletions(-) create mode 100644 _data/language_map.yml create mode 100644 _data/languages/en.yml create mode 100644 _data/languages/es.yml create mode 100644 _plugins/hreflang-tag.rb create mode 100644 _plugins/translate-tag.rb create mode 100644 _plugins/translated-page-generator.rb create mode 100644 _plugins/weblate-source-file.rb diff --git a/.gitignore b/.gitignore index e6cb179f..4170d373 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ font/assets/ font/_sass/ font/.fontcustom-manifest.json assets/webfonts/ptio-font-preview.html +weblate-source-file.yml diff --git a/Gemfile b/Gemfile index 70f8d954..8410b95b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,11 +1,12 @@ source "https://rubygems.org" # Install github-pages gem (https://jekyllrb.com/docs/github-pages/) -gem "github-pages", group: :jekyll_plugins +gem "jekyll", group: :jekyll_plugins # Plugins group :jekyll_plugins do # example: gem "jekyll-feed", "~> 0.6" + gem "jekyll-sitemap" end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem diff --git a/Gemfile.lock b/Gemfile.lock index 05594934..8ec995d9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,89 +1,16 @@ GEM remote: https://rubygems.org/ specs: - activesupport (4.2.11.1) - i18n (~> 0.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) - addressable (2.6.0) - public_suffix (>= 2.0.2, < 4.0) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.11.1) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) colorator (1.1.0) - commonmarker (0.17.13) - ruby-enum (~> 0.5) concurrent-ruby (1.1.5) - dnsruby (1.61.3) - addressable (~> 2.5) em-websocket (0.5.1) eventmachine (>= 0.12.9) http_parser.rb (~> 0.6.0) - ethon (0.12.0) - ffi (>= 1.3.0) eventmachine (1.2.7) - execjs (2.7.0) - faraday (0.15.4) - multipart-post (>= 1.2, < 3) - ffi (1.11.1) + ffi (1.11.2) forwardable-extended (2.6.0) - gemoji (3.0.1) - github-pages (198) - activesupport (= 4.2.11.1) - github-pages-health-check (= 1.16.1) - jekyll (= 3.8.5) - jekyll-avatar (= 0.6.0) - jekyll-coffeescript (= 1.1.1) - jekyll-commonmark-ghpages (= 0.1.5) - jekyll-default-layout (= 0.1.4) - jekyll-feed (= 0.11.0) - jekyll-gist (= 1.5.0) - jekyll-github-metadata (= 2.12.1) - jekyll-mentions (= 1.4.1) - jekyll-optional-front-matter (= 0.3.0) - jekyll-paginate (= 1.1.0) - jekyll-readme-index (= 0.2.0) - jekyll-redirect-from (= 0.14.0) - jekyll-relative-links (= 0.6.0) - jekyll-remote-theme (= 0.3.1) - jekyll-sass-converter (= 1.5.2) - jekyll-seo-tag (= 2.5.0) - jekyll-sitemap (= 1.2.0) - jekyll-swiss (= 0.4.0) - jekyll-theme-architect (= 0.1.1) - jekyll-theme-cayman (= 0.1.1) - jekyll-theme-dinky (= 0.1.1) - jekyll-theme-hacker (= 0.1.1) - jekyll-theme-leap-day (= 0.1.1) - jekyll-theme-merlot (= 0.1.1) - jekyll-theme-midnight (= 0.1.1) - jekyll-theme-minimal (= 0.1.1) - jekyll-theme-modernist (= 0.1.1) - jekyll-theme-primer (= 0.5.3) - jekyll-theme-slate (= 0.1.1) - jekyll-theme-tactile (= 0.1.1) - jekyll-theme-time-machine (= 0.1.1) - jekyll-titles-from-headings (= 0.5.1) - jemoji (= 0.10.2) - kramdown (= 1.17.0) - liquid (= 4.0.0) - listen (= 3.1.5) - mercenary (~> 0.3) - minima (= 2.5.0) - nokogiri (>= 1.8.5, < 2.0) - rouge (= 2.2.1) - terminal-table (~> 1.4) - github-pages-health-check (1.16.1) - addressable (~> 2.3) - dnsruby (~> 1.60) - octokit (~> 4.0) - public_suffix (~> 3.0) - typhoeus (~> 1.3) - html-pipeline (2.12.0) - activesupport (>= 2) - nokogiri (>= 1.4) http_parser.rb (0.6.0) i18n (0.9.5) concurrent-ruby (~> 1.0) @@ -100,97 +27,12 @@ GEM pathutil (~> 0.9) rouge (>= 1.7, < 4) safe_yaml (~> 1.0) - jekyll-avatar (0.6.0) - jekyll (~> 3.0) - jekyll-coffeescript (1.1.1) - coffee-script (~> 2.2) - coffee-script-source (~> 1.11.1) - jekyll-commonmark (1.3.1) - commonmarker (~> 0.14) - jekyll (>= 3.7, < 5.0) - jekyll-commonmark-ghpages (0.1.5) - commonmarker (~> 0.17.6) - jekyll-commonmark (~> 1) - rouge (~> 2) - jekyll-default-layout (0.1.4) - jekyll (~> 3.0) - jekyll-feed (0.11.0) - jekyll (~> 3.3) - jekyll-gist (1.5.0) - octokit (~> 4.2) - jekyll-github-metadata (2.12.1) - jekyll (~> 3.4) - octokit (~> 4.0, != 4.4.0) - jekyll-mentions (1.4.1) - html-pipeline (~> 2.3) - jekyll (~> 3.0) - jekyll-optional-front-matter (0.3.0) - jekyll (~> 3.0) - jekyll-paginate (1.1.0) - jekyll-readme-index (0.2.0) - jekyll (~> 3.0) - jekyll-redirect-from (0.14.0) - jekyll (~> 3.3) - jekyll-relative-links (0.6.0) - jekyll (~> 3.3) - jekyll-remote-theme (0.3.1) - jekyll (~> 3.5) - rubyzip (>= 1.2.1, < 3.0) jekyll-sass-converter (1.5.2) sass (~> 3.4) - jekyll-seo-tag (2.5.0) - jekyll (~> 3.3) jekyll-sitemap (1.2.0) jekyll (~> 3.3) - jekyll-swiss (0.4.0) - jekyll-theme-architect (0.1.1) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-cayman (0.1.1) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-dinky (0.1.1) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-hacker (0.1.1) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-leap-day (0.1.1) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-merlot (0.1.1) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-midnight (0.1.1) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-minimal (0.1.1) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-modernist (0.1.1) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-primer (0.5.3) - jekyll (~> 3.5) - jekyll-github-metadata (~> 2.9) - jekyll-seo-tag (~> 2.0) - jekyll-theme-slate (0.1.1) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-tactile (0.1.1) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-time-machine (0.1.1) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-titles-from-headings (0.5.1) - jekyll (~> 3.3) jekyll-watch (2.2.1) listen (~> 3.0) - jemoji (0.10.2) - gemoji (~> 3.0) - html-pipeline (~> 2.2) - jekyll (~> 3.0) kramdown (1.17.0) liquid (4.0.0) listen (3.1.5) @@ -198,51 +40,27 @@ GEM rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) mercenary (0.3.6) - mini_portile2 (2.4.0) - minima (2.5.0) - jekyll (~> 3.5) - jekyll-feed (~> 0.9) - jekyll-seo-tag (~> 2.1) - minitest (5.11.3) - multipart-post (2.1.1) - nokogiri (1.10.4) - mini_portile2 (~> 2.4.0) - octokit (4.14.0) - sawyer (~> 0.8.0, >= 0.5.3) pathutil (0.16.2) forwardable-extended (~> 2.6) public_suffix (3.1.1) rb-fsevent (0.10.3) rb-inotify (0.10.0) ffi (~> 1.0) - rouge (2.2.1) - ruby-enum (0.7.2) - i18n + rouge (3.11.0) ruby_dep (1.5.0) - rubyzip (1.2.3) safe_yaml (1.0.5) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sawyer (0.8.2) - addressable (>= 2.3.5) - faraday (> 0.8, < 2.0) - terminal-table (1.8.0) - unicode-display_width (~> 1.1, >= 1.1.1) - thread_safe (0.3.6) - typhoeus (1.3.1) - ethon (>= 0.9.0) - tzinfo (1.2.5) - thread_safe (~> 0.1) - unicode-display_width (1.6.0) PLATFORMS ruby DEPENDENCIES - github-pages + jekyll + jekyll-sitemap tzinfo-data BUNDLED WITH diff --git a/_config.yml b/_config.yml index 25a9c243..22468756 100644 --- a/_config.yml +++ b/_config.yml @@ -7,7 +7,8 @@ sass: style: compressed plugins: - jekyll-sitemap +plugins_dir: "./_plugins" sitemap: file: "/sitemap.xml" include: [".well-known"] -exclude: ["font", "vendor"] +exclude: ["font", "vendor","weblate-source-file.yml"] diff --git a/_data/language_map.yml b/_data/language_map.yml new file mode 100644 index 00000000..9deecc2f --- /dev/null +++ b/_data/language_map.yml @@ -0,0 +1,47 @@ +--- +af: "Afrikaans" +az: "Azərbaycanca" +bg: "Български" +ca: "Català" +cs: "Česky" +da: "Dansk" +de: "Deutsch" +el: "Ελληνικά" +en: "English" +es: "Español" +et: "esti" +fa: "فارسی" +fi: "suomi" +fil: "Pilipino" +fr: "Français" +ga: "Gaeilge" +hr: "Hrvatski" +hu: "Magyar" +id: "Bahasa Indonesia" +it: "Italiano" +ja: "日本語" +kk: "Қазақ" +ko: "한국어" +lt: "Lietuviškai" +lv: "Latviešu" +mk: "Македонски" +ms: "Bahasa Melayu" +nb: "Norsk" +nl: "Nederlands" +pl: "Polski" +pt_BR: "Português (br)" +pt_PT: "Português (pt)" +ro: "Română" +ru: "Pусский" +sk: "Slovenčina" +sl: "Slovenščina" +sr: "српски" +sv: "svensk" +sw: "Kiswahili" +th: "ภาษาไทย" +tr: "Türkçe" +uk: "Українська" +uz: "O'zbekcha" +vi: "Tiếng Việt" +zh_CN: "简体中文" +zh_TW: "繁體中文" diff --git a/_data/languages/en.yml b/_data/languages/en.yml new file mode 100644 index 00000000..05e6d46b --- /dev/null +++ b/_data/languages/en.yml @@ -0,0 +1,13 @@ +--- +sponsors: | + Sponsors + +new: | + New! + +showcase_your_brand_as_a_sponsor_of_privacytools_here_and_support_our_mission_of_creating_a_world_fre: | + Showcase your brand as a sponsor of PrivacyTools here and support our mission of creating a world free of mass surveillance! + +learn_more: | + Learn more... + diff --git a/_data/languages/es.yml b/_data/languages/es.yml new file mode 100644 index 00000000..56181882 --- /dev/null +++ b/_data/languages/es.yml @@ -0,0 +1,13 @@ +--- +sponsors: | + Patrocinadores + +new: | + Nuevo! + +showcase_your_brand_as_a_sponsor_of_privacytools_here_and_support_our_mission_of_creating_a_world_fre: | + Presente su marca como patrocinador de PrivacyTools aquí y apoye nuestra misión de crear un mundo libre de vigilancia masiva! + +learn_more: | + Conozca más... + diff --git a/_plugins/hreflang-tag.rb b/_plugins/hreflang-tag.rb new file mode 100644 index 00000000..4ebf3ab2 --- /dev/null +++ b/_plugins/hreflang-tag.rb @@ -0,0 +1,35 @@ +# Copyright 2019 Signal +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +module Jekyll + + class HreflangTag < Liquid::Tag + def initialize(tag_name, text, tokens) + super + end + + def render(context) + page = context.environments.first["page"] + site = context.registers[:site] + + if page["translate"] + dir = page["src_dir"].nil? ? page["dir"] : page["src_dir"] + hreflangs = %{} + + site.data["languages"].each_key do |language| + hreflangs << %{} + end + end + + hreflangs + end + end + +end + +Liquid::Template.register_tag('hreflang', Jekyll::HreflangTag) diff --git a/_plugins/translate-tag.rb b/_plugins/translate-tag.rb new file mode 100644 index 00000000..51fecec2 --- /dev/null +++ b/_plugins/translate-tag.rb @@ -0,0 +1,38 @@ +# Copyright 2019 Signal +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +module Jekyll + + class TranslateTag < Liquid::Tag + attr_reader :text, :weblate_id + + def initialize(tag_name, text, tokens) + super + @text = text.strip + @weblate_id = Weblate::ID.get(text) + end + + def render(context) + page_language = context.environments.first["page"]["language"] + site = context.registers[:site] + + if page_language.nil? + Weblate::SourceFile.add_entry(weblate_id, text) + + text + else + translated_string = site.data["languages"][page_language][weblate_id] + + translated_string.nil? ? text : translated_string.strip + end + end + end + +end + +Liquid::Template.register_tag('translate', Jekyll::TranslateTag) diff --git a/_plugins/translated-page-generator.rb b/_plugins/translated-page-generator.rb new file mode 100644 index 00000000..af47b983 --- /dev/null +++ b/_plugins/translated-page-generator.rb @@ -0,0 +1,47 @@ +# Copyright 2019 Signal +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +module Jekyll + + class TranslatedPage < Page + def initialize(site, base, dir, name) + @site, @base, @dir, @name = site, base, dir, name + + self.process(@name) + self.data ||= {} + end + end + + class TranslatedPageGenerator < Generator + def generate(site) + pages_to_translate = site.pages.select { |page| page.data["translate"] } + + pages_to_translate.each do |page| + page_title = page.data['title'] + page_title_weblate_id = Weblate::ID.get(page_title) + + Weblate::SourceFile.add_entry(page_title_weblate_id, page_title) + + site.data["languages"].each_key do |language| + translated_page = Jekyll::TranslatedPage.new(site, site.source, page.dir, page.name) + translated_page_title = site.data["languages"][language][page_title_weblate_id] + + translated_page.data = page.data.clone + translated_page.data['title'] = translated_page_title.nil? ? page_title : translated_page_title.strip + translated_page.data['permalink'] = "#{language}/#{page.dir}/#{page.name}" + translated_page.data['src_dir'] = page.dir + translated_page.data['language'] = language + translated_page.content = page.content + + site.pages << translated_page + end + end + end + end + +end diff --git a/_plugins/weblate-source-file.rb b/_plugins/weblate-source-file.rb new file mode 100644 index 00000000..d71fc994 --- /dev/null +++ b/_plugins/weblate-source-file.rb @@ -0,0 +1,49 @@ +# Copyright 2019 Signal +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +module Weblate + + class ID + def self.get(source_text) + source_text.nil? ? source_text : source_text.strip[0..100].gsub(/[^\w\d\s]/, '').tr(' ', '_').downcase + end + end + + class SourceFile + class << self + def add_entry(weblate_id, source_text) + unless id_already_exists?(weblate_id) or source_text.nil? + new_entry = <<-YAML +#{weblate_id}: | + #{source_text} + + YAML + + File.write(weblate_source_location, new_entry, mode: 'a') + end + end + + def id_already_exists?(weblate_id) + File.readlines(weblate_source_location).grep(/^#{weblate_id}: \|$/).any? + end + + def refresh + File.write(weblate_source_location, "---\n") + end + + def weblate_source_location + "#{__dir__}/../weblate-source-file.yml" + end + end + end + +end + +Jekyll::Hooks.register :site, :after_init do + Weblate::SourceFile.refresh +end diff --git a/index.html b/index.html index cdb2ba37..c004650a 100644 --- a/index.html +++ b/index.html @@ -1,14 +1,15 @@ --- layout: default +translate: true --- {% include sections/header.html %} {% include sections/resources.html %} -

Sponsors

+

{%translate Sponsors%}

{% include sections/quotes.html %} {% include sections/privacy-resources.html %} -- 2.47.2 From 95f87e234c409a410a30735f662770fbf3639d3f Mon Sep 17 00:00:00 2001 From: djoate <56777051+djoate@users.noreply.github.com> Date: Mon, 18 Nov 2019 01:18:12 +0000 Subject: [PATCH 02/16] Translate more of the index.html * Translate more of index.html, with translations sourced from deepl.com * Relax the plugin to allow capitalization, periods, exclamation marks, and question marks in the Weblate ID for YAML src. This helps differentiate between similar but different strings. --- .gitignore | 2 +- _data/languages/es.yml | 52 ++++++++++++++++++++++--- _includes/card.html | 2 +- _includes/sections/resources.html | 62 +++++++++++++++++++++--------- _plugins/weblate-source-file.rb | 2 +- weblate-source-file.yml | 64 +++++++++++++++++++++++++++++++ 6 files changed, 157 insertions(+), 27 deletions(-) create mode 100644 weblate-source-file.yml diff --git a/.gitignore b/.gitignore index 4170d373..4c76a727 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,4 @@ font/assets/ font/_sass/ font/.fontcustom-manifest.json assets/webfonts/ptio-font-preview.html -weblate-source-file.yml +# weblate-source-file.yml diff --git a/_data/languages/es.yml b/_data/languages/es.yml index 56181882..91516e4e 100644 --- a/_data/languages/es.yml +++ b/_data/languages/es.yml @@ -1,13 +1,55 @@ --- -sponsors: | +Prefer_the_classic_site?_View_a_singlepage_layout.: | + ¿Prefieres el sitio clásico? Ver un diseño de una sola página. + +Providers: | + Proveedores + +Discover_privacycentric_online_services_including_email_providers_VPN_operators_DNS_administrator: | + Descubra servicios en línea centrados en la privacidad, incluyendo proveedores de correo electrónico, operadores de VPN, administradores de DNS y mucho más! + +Learn_More: | + Aprenda Más + +Web_Browsers: | + Navegadores Web + +Find_a_web_browser_that_respects_your_privacy_and_discover_how_to_harden_your_browser_against_tracki: | + Encuentre un navegador web que respete su privacidad y descubra cómo proteger su navegador contra el rastreo y las fugas. + +Software: | + Software + +Discover_a_variety_of_open_source_software_built_to_protect_your_privacy_and_keep_your_digital_data_s: | + Descubra una variedad de software de código abierto creado para proteger su privacidad y mantener sus datos digitales seguros. + +Operating_Systems: | + Sistemas Operativos + +Find_out_how_your_operating_system_is_compromising_your_privacy_and_what_simple_alternatives_exist.: | + Descubra cómo su sistema operativo está comprometiendo su privacidad y qué alternativas sencillas existen. + +PrivacyTools_Services: | + Servicios de PrivacyTools + +The_PrivacyTools_team_is_proud_to_launch_a_variety_of_privacycentric_online_services_including_a_Ma: | + El equipo de PrivacyTools se enorgullece de lanzar una variedad de servicios en línea centrados en la privacidad, incluyendo una instancia de Mastodon, un motor de búsqueda y mucho más. + +Donate: | + Donaciones + +We_cant_operate_this_site_without_the_generous_contributions_we_receive_from_our_viewers._If_you_lov: | + No podemos operar este sitio sin las generosas contribuciones que recibimos de nuestros televidentes. Si usted ama la privacidad y nuestro sitio web por favor considere donar. + +Sponsors: | Patrocinadores -new: | +New: | Nuevo! -showcase_your_brand_as_a_sponsor_of_privacytools_here_and_support_our_mission_of_creating_a_world_fre: | +Showcase_your_brand_as_a_sponsor_of_PrivacyTools_here_and_support_our_mission_of_creating_a_world_fre: | Presente su marca como patrocinador de PrivacyTools aquí y apoye nuestra misión de crear un mundo libre de vigilancia masiva! -learn_more: | - Conozca más... +Learn_more...: | + Aprenda más... diff --git a/_includes/card.html b/_includes/card.html index ec676c84..715e1bda 100644 --- a/_includes/card.html +++ b/_includes/card.html @@ -51,7 +51,7 @@ {% if include.moretext %} {{include.moretext}} {% else %} - Learn More + {% translate Learn More %} {% endif %} {% endif %} diff --git a/_includes/sections/resources.html b/_includes/sections/resources.html index 66e6c395..43cb8250 100644 --- a/_includes/sections/resources.html +++ b/_includes/sections/resources.html @@ -1,55 +1,79 @@

Privacy Tools

-

Prefer the classic site? View a single-page layout.

+

{% translate Prefer the classic site? View a single-page layout.%}

+ {% capture providers_title %}{% translate Providers %}{% endcapture %} + {% capture providers_page %}/{% if page.language %}{{ page.language }}/{% endif %}providers/{% endcapture %} + {% capture providers_description %}{% translate Discover privacy-centric online services, including email providers, VPN operators, DNS administrators, and more!%}{% endcapture %} + {% include card.html color="success" - title="Providers" + title=providers_title icon="fas fa-server" iconcolor="dark" - page="/providers/" - description="Discover privacy-centric online services, including email providers, VPN operators, DNS administrators, and more!" + page=providers_page + description=providers_description %} + {% capture browsers_title %}{% translate Web Browsers %}{% endcapture %} + {% capture browsers_page %}/{% if page.language %}{{ page.language }}/{% endif %}browsers/{% endcapture %} + {% capture browsers_description %}{% translate Find a web browser that respects your privacy, and discover how to harden your browser against tracking and leaks.%}{% endcapture %} + {% include card.html color="primary" - title="Web Browsers" + title=browsers_title icon="far fa-compass" iconcolor="dark" - page="/browsers/" - description="Find a web browser that respects your privacy, and discover how to harden your browser against tracking and leaks." + page=browsers_page + description=browsers_description %} + {% capture software_title %}{% translate Software %}{% endcapture %} + {% capture software_page %}/{% if page.language %}{{ page.language }}/{% endif %}software/{% endcapture %} + {% capture software_description %}{% translate Discover a variety of open source software built to protect your privacy and keep your digital data secure.%}{% endcapture %} + {% include card.html color="warning" - title="Software" + title=software_title icon="far fa-window-restore" iconcolor="dark" - page="/software/" - description="Discover a variety of open source software built to protect your privacy and keep your digital data secure." + page=software_page + description=software_description %} + {% capture os_title %}{% translate Operating Systems%}{% endcapture %} + {% capture os_page %}/{% if page.language %}{{ page.language }}/{% endif %}operating-systems/{% endcapture %} + {% capture os_description %}{% translate Find out how your operating system is compromising your privacy, and what simple alternatives exist.%}{% endcapture %} + {% include card.html color="info" - title="Operating Systems" + title=os_title icon="fas fa-desktop" iconcolor="dark" - page="/operating-systems/" - description="Find out how your operating system is compromising your privacy, and what simple alternatives exist." + page=os_page + description=os_description %} + {% capture services_title %}{% translate PrivacyTools Services%}{% endcapture %} + {% capture services_page %}/{% if page.language %}{{ page.language }}/{% endif %}services/{% endcapture %} + {% capture services_description %}{% translate The PrivacyTools team is proud to launch a variety of privacy-centric online services, including a Mastodon instance, search engine, and more!%}{% endcapture %} + {% include card.html color="secondary" - title="PrivacyTools Services" + title=services_title icon="far fa-eye-slash" iconcolor="dark" - page="/services/" - description="The PrivacyTools team is proud to launch a variety of privacy-centric online services, including a Mastodon instance, search engine, and more!" + page=services_page + description=services_description %} + {% capture donate_title %}{% translate Donate%}{% endcapture %} + {% capture donate_page %}/{% if page.language %}{{ page.language }}/{% endif %}donate/{% endcapture %} + {% capture donate_description %}{% translate We can't operate this site without the generous contributions we receive from our viewers. If you love privacy and our website please consider donating.%}{% endcapture %} + {% include card.html color="danger" - title="Donate" + title=donate_title icon="fas fa-donate" iconcolor="dark" - page="/donate/" - description="We can't operate this site without the generous contributions we receive from our viewers. If you love privacy and our website please consider donating." + page=donate_page + description=donate_description %}
diff --git a/_plugins/weblate-source-file.rb b/_plugins/weblate-source-file.rb index d71fc994..cd5ad413 100644 --- a/_plugins/weblate-source-file.rb +++ b/_plugins/weblate-source-file.rb @@ -10,7 +10,7 @@ module Weblate class ID def self.get(source_text) - source_text.nil? ? source_text : source_text.strip[0..100].gsub(/[^\w\d\s]/, '').tr(' ', '_').downcase + source_text.nil? ? source_text : source_text.strip[0..100].gsub(/[^\w\d\s\.\?\!]/, '').tr(' ', '_') end end diff --git a/weblate-source-file.yml b/weblate-source-file.yml new file mode 100644 index 00000000..ca5ddb55 --- /dev/null +++ b/weblate-source-file.yml @@ -0,0 +1,64 @@ +--- +Prefer_the_classic_site?_View_a_singlepage_layout.: | + Prefer the classic site? View a single-page layout. + +Providers: | + Providers + +Discover_privacycentric_online_services_including_email_providers_VPN_operators_DNS_administrator: | + Discover privacy-centric online services, including email providers, VPN operators, DNS administrators, and more! + +Learn_More: | + Learn More + +Web_Browsers: | + Web Browsers + +Find_a_web_browser_that_respects_your_privacy_and_discover_how_to_harden_your_browser_against_tracki: | + Find a web browser that respects your privacy, and discover how to harden your browser against tracking and leaks. + +Software: | + Software + +Discover_a_variety_of_open_source_software_built_to_protect_your_privacy_and_keep_your_digital_data_s: | + Discover a variety of open source software built to protect your privacy and keep your digital data secure. + +Operating_Systems: | + Operating Systems + +Find_out_how_your_operating_system_is_compromising_your_privacy_and_what_simple_alternatives_exist.: | + Find out how your operating system is compromising your privacy, and what simple alternatives exist. + +PrivacyTools_Services: | + PrivacyTools Services + +The_PrivacyTools_team_is_proud_to_launch_a_variety_of_privacycentric_online_services_including_a_Ma: | + The PrivacyTools team is proud to launch a variety of privacy-centric online services, including a Mastodon instance, search engine, and more! + +Donate: | + Donate + +We_cant_operate_this_site_without_the_generous_contributions_we_receive_from_our_viewers._If_you_lov: | + We can't operate this site without the generous contributions we receive from our viewers. If you love privacy and our website please consider donating. + +Sponsors: | + Sponsors + +New!: | + New! + +Showcase_your_brand_as_a_sponsor_of_PrivacyTools_here_and_support_our_mission_of_creating_a_world_fre: | + Showcase your brand as a sponsor of PrivacyTools here and support our mission of creating a world free of mass surveillance! + +Learn_more...: | + Learn more... + +Prefer_the_classic_site?_View_a_singlepage_layout.: | + Prefer the classic site? View a single-page layout. + +Prefer_the_classic_site?_View_a_singlepage_layout.: | + Prefer the classic site? View a single-page layout. + +Prefer_the_classic_site?_View_a_singlepage_layout.: | + Prefer the classic site? View a single-page layout. + -- 2.47.2 From 8f216deec5dde578e3895067491085f36bbbed4d Mon Sep 17 00:00:00 2001 From: djoate <56777051+djoate@users.noreply.github.com> Date: Mon, 18 Nov 2019 01:45:28 +0000 Subject: [PATCH 03/16] Key 'Privacy Tools', and get rid of en.yml --- _data/languages/en.yml | 13 ------------- _data/languages/es.yml | 3 +++ _includes/sections/resources.html | 2 +- weblate-source-file.yml | 6 +++--- 4 files changed, 7 insertions(+), 17 deletions(-) delete mode 100644 _data/languages/en.yml diff --git a/_data/languages/en.yml b/_data/languages/en.yml deleted file mode 100644 index 05e6d46b..00000000 --- a/_data/languages/en.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -sponsors: | - Sponsors - -new: | - New! - -showcase_your_brand_as_a_sponsor_of_privacytools_here_and_support_our_mission_of_creating_a_world_fre: | - Showcase your brand as a sponsor of PrivacyTools here and support our mission of creating a world free of mass surveillance! - -learn_more: | - Learn more... - diff --git a/_data/languages/es.yml b/_data/languages/es.yml index 91516e4e..c35cc4fe 100644 --- a/_data/languages/es.yml +++ b/_data/languages/es.yml @@ -1,4 +1,7 @@ --- +Privacy_Tools: | + Privacy Tools + Prefer_the_classic_site?_View_a_singlepage_layout.: | ¿Prefieres el sitio clásico? Ver un diseño de una sola página. diff --git a/_includes/sections/resources.html b/_includes/sections/resources.html index 43cb8250..f8f904eb 100644 --- a/_includes/sections/resources.html +++ b/_includes/sections/resources.html @@ -1,4 +1,4 @@ -

Privacy Tools

+

{% translate Privacy Tools %}

{% translate Prefer the classic site? View a single-page layout.%}

diff --git a/weblate-source-file.yml b/weblate-source-file.yml index ca5ddb55..93c6c75e 100644 --- a/weblate-source-file.yml +++ b/weblate-source-file.yml @@ -1,4 +1,7 @@ --- +Privacy_Tools: | + Privacy Tools + Prefer_the_classic_site?_View_a_singlepage_layout.: | Prefer the classic site? View a single-page layout. @@ -59,6 +62,3 @@ Prefer_the_classic_site?_View_a_singlepage_layout.: | Prefer_the_classic_site?_View_a_singlepage_layout.: | Prefer the classic site? View a single-page layout. -Prefer_the_classic_site?_View_a_singlepage_layout.: | - Prefer the classic site? View a single-page layout. - -- 2.47.2 From cab6bd18b81483e4c6f2a826ecdf1c2f18316538 Mon Sep 17 00:00:00 2001 From: djoate <56777051+djoate@users.noreply.github.com> Date: Mon, 18 Nov 2019 23:09:39 -0500 Subject: [PATCH 04/16] Add support for translating page.description --- _plugins/translated-page-generator.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/_plugins/translated-page-generator.rb b/_plugins/translated-page-generator.rb index af47b983..73279ae8 100644 --- a/_plugins/translated-page-generator.rb +++ b/_plugins/translated-page-generator.rb @@ -24,15 +24,20 @@ module Jekyll pages_to_translate.each do |page| page_title = page.data['title'] page_title_weblate_id = Weblate::ID.get(page_title) + page_description = page.data['description'] + page_description_weblate_id = Weblate::ID.get(page_description) Weblate::SourceFile.add_entry(page_title_weblate_id, page_title) + Weblate::SourceFile.add_entry(page_description_weblate_id, page_description) site.data["languages"].each_key do |language| translated_page = Jekyll::TranslatedPage.new(site, site.source, page.dir, page.name) translated_page_title = site.data["languages"][language][page_title_weblate_id] + translated_page_description = site.data["languages"][language][page_description_weblate_id] translated_page.data = page.data.clone translated_page.data['title'] = translated_page_title.nil? ? page_title : translated_page_title.strip + translated_page.data['description'] = translated_page_description.nil? ? page_description : translated_page_description.strip translated_page.data['permalink'] = "#{language}/#{page.dir}/#{page.name}" translated_page.data['src_dir'] = page.dir translated_page.data['language'] = language -- 2.47.2 From 3abed603b5d5266cb7786470787d11f842c92c91 Mon Sep 17 00:00:00 2001 From: djoate <56777051+djoate@users.noreply.github.com> Date: Mon, 18 Nov 2019 23:10:33 -0500 Subject: [PATCH 05/16] Translate a part of providers page --- _data/languages/es.yml | 36 ++++++++++++++++++++++++++++++++++ pages/providers.html | 25 ++++++++++++------------ weblate-source-file.yml | 43 ++++++++++++++++++++++++++++++++++++----- 3 files changed, 87 insertions(+), 17 deletions(-) diff --git a/_data/languages/es.yml b/_data/languages/es.yml index c35cc4fe..6efcd784 100644 --- a/_data/languages/es.yml +++ b/_data/languages/es.yml @@ -8,6 +8,9 @@ Prefer_the_classic_site?_View_a_singlepage_layout.: | Providers: | Proveedores +Theres_a_ton_of_people_providing_services_online._Discover_which_ones_you_should_avoid_and_our_recom: | + Hay un montón de gente que presta servicios en línea. Descubra cuáles debe evitar y nuestras recomendaciones para una variedad de servicios. + Discover_privacycentric_online_services_including_email_providers_VPN_operators_DNS_administrator: | Descubra servicios en línea centrados en la privacidad, incluyendo proveedores de correo electrónico, operadores de VPN, administradores de DNS y mucho más! @@ -56,3 +59,36 @@ Showcase_your_brand_as_a_sponsor_of_PrivacyTools_here_and_support_our_mission_of Learn_more...: | Aprenda más... +Services: | + Servicios + +Click_on_whatever_service_you_need_to_view_our_recommendations.: | + Haga clic en cualquier servicio que necesite para ver nuestras recomendaciones. + +Cloud_Storage: | + Servidor Cloud + +DNS: | + DNS + +Email: | + Correo electrónico + +Hosting: | + Alojamiento + +Pastebins: | + Pastebins + +Search_Engines: | + Motores de Búsqueda + +Social_Networks: | + Redes Sociales + +Social_News_Aggregators: | + Noticias Sociales Agregadores + +VPN: | + RPV + diff --git a/pages/providers.html b/pages/providers.html index e78f9a4a..f17d2f86 100644 --- a/pages/providers.html +++ b/pages/providers.html @@ -1,25 +1,26 @@ --- layout: page permalink: /providers/ -title: "Providers" +title: Providers description: "There's a ton of people providing services online. Discover which ones you should avoid and our recommendations for a variety of services." +translate: true --- -

Services

+

{% translate Services%}

-

Click on whatever service you need to view our recommendations.

+

{% translate Click on whatever service you need to view our recommendations.%}

diff --git a/weblate-source-file.yml b/weblate-source-file.yml index 93c6c75e..509a15e1 100644 --- a/weblate-source-file.yml +++ b/weblate-source-file.yml @@ -1,13 +1,16 @@ --- +Providers: | + Providers + +Theres_a_ton_of_people_providing_services_online._Discover_which_ones_you_should_avoid_and_our_recom: | + There's a ton of people providing services online. Discover which ones you should avoid and our recommendations for a variety of services. + Privacy_Tools: | Privacy Tools Prefer_the_classic_site?_View_a_singlepage_layout.: | Prefer the classic site? View a single-page layout. -Providers: | - Providers - Discover_privacycentric_online_services_including_email_providers_VPN_operators_DNS_administrator: | Discover privacy-centric online services, including email providers, VPN operators, DNS administrators, and more! @@ -56,8 +59,38 @@ Showcase_your_brand_as_a_sponsor_of_PrivacyTools_here_and_support_our_mission_of Learn_more...: | Learn more... -Prefer_the_classic_site?_View_a_singlepage_layout.: | - Prefer the classic site? View a single-page layout. +Services: | + Services + +Click_on_whatever_service_you_need_to_view_our_recommendations.: | + Click on whatever service you need to view our recommendations. + +Cloud_Storage: | + Cloud Storage + +DNS: | + DNS + +Email: | + Email + +Hosting: | + Hosting + +Pastebins: | + Pastebins + +Search_Engines: | + Search Engines + +Social_Networks: | + Social Networks + +Social_News_Aggregators: | + Social News Aggregators + +VPN: | + VPN Prefer_the_classic_site?_View_a_singlepage_layout.: | Prefer the classic site? View a single-page layout. -- 2.47.2 From 2ace1bfe6c95ac42acb6af0fc8db412d21707ffd Mon Sep 17 00:00:00 2001 From: djoate <56777051+djoate@users.noreply.github.com> Date: Mon, 18 Nov 2019 23:29:43 -0500 Subject: [PATCH 06/16] Fix permalinks in page generator --- _plugins/translated-page-generator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_plugins/translated-page-generator.rb b/_plugins/translated-page-generator.rb index 73279ae8..9624d240 100644 --- a/_plugins/translated-page-generator.rb +++ b/_plugins/translated-page-generator.rb @@ -38,7 +38,7 @@ module Jekyll translated_page.data = page.data.clone translated_page.data['title'] = translated_page_title.nil? ? page_title : translated_page_title.strip translated_page.data['description'] = translated_page_description.nil? ? page_description : translated_page_description.strip - translated_page.data['permalink'] = "#{language}/#{page.dir}/#{page.name}" + translated_page.data['permalink'] = "#{language}/#{page.dir}" translated_page.data['src_dir'] = page.dir translated_page.data['language'] = language translated_page.content = page.content -- 2.47.2 From 981761373623a5452cbf75a72eff5a2111028af0 Mon Sep 17 00:00:00 2001 From: djoate <56777051+djoate@users.noreply.github.com> Date: Mon, 18 Nov 2019 23:30:29 -0500 Subject: [PATCH 07/16] Partially translate providers/cloud-storage/ --- _data/languages/es.yml | 9 ++++++++ _includes/sections/cloud-storage.html | 10 ++++---- pages/providers.html | 2 +- pages/providers/storage.html | 1 + weblate-source-file.yml | 33 ++++++++++++++++++++++++--- 5 files changed, 46 insertions(+), 9 deletions(-) diff --git a/_data/languages/es.yml b/_data/languages/es.yml index 6efcd784..d4a86356 100644 --- a/_data/languages/es.yml +++ b/_data/languages/es.yml @@ -59,6 +59,15 @@ Showcase_your_brand_as_a_sponsor_of_PrivacyTools_here_and_support_our_mission_of Learn_more...: | Aprenda más... +Encrypted_Cloud_Storage_Services: | + Servicios de Almacenamiento en Nube Cifrada + +If_you_are_currently_using_Dropbox_Google_Drive_Microsoft_OneDrive_or_Apple_iCloud_you_should_pick: | + Si actualmente usas Dropbox, Google Drive, Microsoft OneDrive o Apple iCloud, deberías elegir una alternativa aquí. + +Worth_Mentioning: | + Destacados + Services: | Servicios diff --git a/_includes/sections/cloud-storage.html b/_includes/sections/cloud-storage.html index f88e56d0..111911fe 100644 --- a/_includes/sections/cloud-storage.html +++ b/_includes/sections/cloud-storage.html @@ -1,7 +1,7 @@ -

Encrypted Cloud Storage Services

+

{% translate Encrypted Cloud Storage Services%}

{% include cardv2.html @@ -23,9 +23,9 @@ googleplay="https://play.google.com/store/apps/details?id=com.nextcloud.client" %} -

Worth Mentioning

+

{% translate Worth Mentioning%}

diff --git a/pages/providers.html b/pages/providers.html index f17d2f86..7aaf85d6 100644 --- a/pages/providers.html +++ b/pages/providers.html @@ -12,7 +12,7 @@ translate: true