-
-
Notifications
You must be signed in to change notification settings - Fork 385
✨ Help Wanted! | Add Weblate i18n Support #1106
Comments
How is this going so far? I'm the main Portuguese maintainer at https://www.privacidade.digital/ (https://github.com/PrivacidadeDigital/privacidade.digital) I confess I was a little concerned with this idea because if you separate the strings in some ways, it would be difficult or impossible to translate to certain languages (if you break sentences). Also, the privacytools domain and basically all of its services (including forum posts that are referenced on the site) are not translated to other languages. There is also a lot of links to external sites that are only available in English. Making all of the strings available as yaml files and on one domain would not allow other language maintainers to change these links to more appropriate ones, or add sections related to their countries. However, there might be some way to work around this with jekyll-multiple-language-plugins using translated pages and permalinks. |
How is this going so far? I'm the main Portuguese maintainer at https://www.privacidade.digital/
It's meh.
I confess I was a little concerned with this idea because if you separate the strings in some ways, it would be difficult or impossible to translate to certain languages (if you break sentences).
Yeah, that's an issue.
There is also a lot of links to external sites that are only available in English.
We can add `<a href="">` links to yaml file.
|
This is probably the main issue to figure out. Jekyll is not super fantastic as an easily translatable platform. |
Yeah, I have used jekyll-multiple-languages-plugin before and I had a hard time doing the SEO as well. I used jekyll-seo plugin but it does not work together with this translation plugin, so I had to stop using it and implementing the SEO myself with Liquid template language and the translation plugin. |
There have been a lot of updates in general over the past few months to the strings and etc., so master may need to be merged into i18n again if possible. It seems that my general fixes to typos in the strings from PR https://github.com/privacytoolsIO/privacytools.io/pull/1418 will have to reapplied to this branch, but I suppose that will happen after we've moved all the existing strings over first. Should we be bolding the service/software/addon name when it appears in the first sentence of a description paragraph? (Related issue: https://github.com/privacytoolsIO/privacytools.io/issues/1420) This seems to only hold currently for the browser addons; as a result, this bold formatting looks inconsistent across the site. For example, these are the strings for Decentraleyes: decentraleyes: "Decentraleyes"
decentraleyes_title: "Decentraleyes: Block Content Delivery Networks"
decentraleyes_description: "emulates Content Delivery Networks locally by intercepting requests, finding the required resource and injecting it into the environment. This all happens instantaneously, automatically, and no prior configuration is required." The corresponding lines of .html: {%- capture title5 -%}{% t browser_addons.decentraleyes_title %}{%- endcapture -%}
{%- capture descr5 -%}<strong>{% t browser_addons.decentraleyes %}</strong> {% t browser_addons.decentraleyes_description %}{%- endcapture -%}
{% include cardv2.html
title=title5
image="/assets/img/addons/decentraleyes.png"
description=descr5
website="https://decentraleyes.org/"
forum="https://forum.privacytools.io/t/discussion-decentraleyes/269"
gitlab="https://git.synz.io/Synzvato/decentraleyes"
firefox=""
chrome=""
opera=""
%} Notice how there are But this is the string for LineageOS: lineageos_descr: "LineageOS is a free and open-source operating system for smartphones and tablets, based on the official releases of the Android Open Source Project. It is the continuation of the CyanogenMod project." and the corresponding lines of .html at {%- capture mobile_os_lineageos_labels -%}warning:contrib:{% t global.contrib %}{%- endcapture -%}
{%- capture mobile_os_lineageos_descr -%}{% t mobile_os.lineageos_descr %}{%- endcapture -%}
{% include cardv2.html
title="LineageOS"
image="/assets/img/tools/LineageOS.png"
description=mobile_os_lineageos_descr
badges="info:AOSP"
labels=mobile_os_lineageos_labels
website="https://www.lineageos.org/"
github="https://github.com/LineageOS"
%} |
With privacytoolsIO/privacy-tools@218a610#diff-510dea53868741105f8d9db818243f0f comes the use of |
👍 I guess I'm most likely going to revert most of those changes. |
@jonaharagon Here is a crude solution that I have found. Have the string in
In the corresponding .html file (in this case, sponsors.html), capture it and use the replace filter: .
.
.
{% capture Sponsors_of_Privacytools %}{% t sponsors.sponsors_of %}{% endcapture %}
<div class="col-12">
<div class="row">
<div class="mx-auto text-center">
<div class="mt-4 mb-4">
<h1>{{ Sponsors_of_Privacytools | replace: "%SITE_NAME", site.name }}</h1>
</div>
.
.
. Such a solution will have to be done for every string that has to use |
I know we might be in a bit too deep into jekyll-multiple-languages, but I was wondering why we chose to use jekyll-multiple-languages plugin. If we're open to changes, there is also this plugin that Signal uses: https://github.com/signalapp/jekyll-simple-i18n From what I saw, their way of doing it makes the source more readable. Here is what a part of index.html of their demo site looks like: <body>
<h1>{% translate Hello world! %}</h1>
<p>{% translate This is an example. %}</p>
<p>{% translate This string will appear in English on generated pages until a translation is added to the YAML file for that language. %}</p>
</body>
</html> The raw strings come out automatically into a YAML after building (although the IDs are a bit verbose): ---
our_website: |
Our website
hello_world: |
Hello world!
this_is_an_example: |
This is an example.
this_string_will_appear_in_english_on_generated_pages_until_a_translation_is_added_to_the_yaml_file_for_that_language: |
This string will appear in English on generated pages until a translation is added to the YAML file for that language.
more_strings_to_look_at: |
More strings to look at. It's initially aimed towards Transifex but it's possible to use it for other translation systems too such as our Weblate install. I don't work with Ruby though, so not sure how to implement it. |
This has now been solved in privacytoolsIO/privacy-tools@9d2f363 |
Almost all of the site has been keyed into separate PRs. See https://github.com/privacytoolsIO/privacytools.io/pull/1509#issuecomment-557949464 for more details. |
Just chiming in to say I'm happy to help providing new Italian translations or contribute to the technology-related discussion 👍 |
How can I help you guys with this? I can see there are many things left to do according to OP, but also @djoate mentioning separate PRs that solves most things? |
@jonaharagon Should probably be able to help you out |
@abbluiz Our work wasn't done in time, so we would likely need to rekey large portions of the site to start up work again. Most of the existing work is in the
A simple merging of This has been a massive timesink for me in the past, and it's also time-sensitive work (if we wait too long, things get out of date quickly). I think we should be hesitant about progressing with this until we get some commitment to review and merge from a member of the @privacytools team. Would also need someone from the team to setup Weblate support again |
Is the link down? https://weblate.nablahost.com/projects/privacytoolsio/ |
Checklist
Description
Alright. So it turns out if we use jekyll-multiple-languages-plugin and throw every single string on the site into
/_i18n/en.yml
we can then use our Weblate install to translate the site much easier.The problem of course, is moving all the strings manually 😅
So that's going to be my project for now. As of df38bc4 I have successfully moved... the index page to
en.yml
, which took about an hour 🙄If anyone wants to help me out with this (which I would greatly appreciate), I'm doing this work in the
i18n
branch of this repo. If you aren't an org member you can create Pull Requests to that branch (as opposed to master), by selecting i18n instead as the base branch in your pull request:What needs to be done
Every English text string in every (HTML and Markdown) file needs to be moved to a key in
en.yml
. For example, lets look this line in_includes/sections/privacy-resources.html
:That is of course the More Privacy Resources header on the homepage. What I've done is taken the English text out of that line, and placed it
en.yml
, like so:Then, back in the HTML file, I replaced the English text with
{% t privacy_resources.header %}
(which is a Jekyll tag saying tot
ranslate the stringprivacy_resources.header
(from the lines above). Like so:Which really isn't that hard! It's simply time consuming to copy/paste everything into this file.
Extra note about translating
{% include card.html
sOkay, so there is one slightly more complicated bit. You can't add the
{% t
tags inside the {% include` tags. For example, you cannot do this:You must instead use some fancy
{% capture
tags, like so:It isn't too complicated, just some extra steps. Look at what I did in
resources.html
for a more complete example.en.yml
You can see how I've formatted this file already, but basically it should be like:
Where "Page" is the section being translated, Key is a brief description, and "String" is the English text. At the top there is also a "Global" section, for strings that are reused a bunch on different pages:
Pretty much everything needs to go into this file, and then this file will automatically be used as the base in Weblate upon which all translations will be based on (which will be far easier).
The text was updated successfully, but these errors were encountered: