[WIP] Add Weblate Support, Move Strings to YAML Files #1105

Merged
jonah merged 40 commits from i18n into master 2019-11-02 20:32:35 +00:00
Owner

➡️ Info and checklist to-do @ #1106 ⬅️

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:

image

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:

...
<h1 id="resources" class="anchor"><a href="#resources"><i class="fas fa-link anchor-icon"></i></a> More Privacy Resources</h1>
...

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:

...
privacy_resources:
  header: "More Privacy Resources"
  ...

Then, back in the HTML file, I replaced the English text with {% t privacy_resources.header %} (which is a Jekyll tag saying to translate the string privacy_resources.header (from the lines above). Like so:

<h1 id="resources" class="anchor"><a href="#resources"><i class="fas fa-link anchor-icon"></i></a> {% t privacy_resources.header %}</h1>

Which really isn't that hard! It's simply time consuming to copy/paste everything into this file.

en.yml

You can see how I've formatted this file already, but basically it should be like:

PAGE:
  KEY: "String"

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:

global:
  further_reading: "Further Reading"

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).

Closes #1106

➡️ **Info and checklist to-do @ #1106** ⬅️ Alright. So it turns out if we use [jekyll-multiple-languages-plugin](https://github.com/kurtsson/jekyll-multiple-languages-plugin) and throw *every single string on the site* into `/_i18n/en.yml` we can then use [our Weblate install](https://weblate.nablahost.com/projects/privacytoolsio/) 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](https://github.com/privacytoolsIO/privacytools.io/tree/i18n) 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: <img width="234" alt="image" src="https://user-images.githubusercontent.com/3637842/62512624-55b41a00-b7de-11e9-95c1-5d7c3136098b.png"> ## 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`: ``` ... <h1 id="resources" class="anchor"><a href="#resources"><i class="fas fa-link anchor-icon"></i></a> More Privacy Resources</h1> ... ``` 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: ``` ... privacy_resources: header: "More Privacy Resources" ... ``` *Then*, back in the HTML file, I replaced the English text with `{% t privacy_resources.header %}` (which is a Jekyll tag saying to `t`ranslate the string `privacy_resources.header` (from the lines above). Like so: ``` <h1 id="resources" class="anchor"><a href="#resources"><i class="fas fa-link anchor-icon"></i></a> {% t privacy_resources.header %}</h1> ``` Which really isn't that hard! It's simply time consuming to copy/paste everything into this file. ## `en.yml` You can see how I've formatted this file already, but basically it should be like: ``` PAGE: KEY: "String" ``` 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: ``` global: further_reading: "Further Reading" ``` 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). Closes #1106
netlify[bot] commented 2019-08-06 05:20:00 +00:00 (Migrated from github.com)
Author
Owner

Deploy preview for privacytools-io ready!

Built with commit d05de7f238

https://deploy-preview-1105--privacytools-io.netlify.com

Deploy preview for *privacytools-io* ready! Built with commit d05de7f23879e9d042a94f3a7fe7537615f56125 https://deploy-preview-1105--privacytools-io.netlify.com
dawidpotocki (Migrated from github.com) reviewed 2019-08-31 09:39:04 +00:00
@ -0,0 +256,4 @@
more: "More Cryptocurrencies"
the: "The"
team: "privacytools.io team"
endorse: "does not necessarily endorse all of the cryptocurrencies listed on this page. Please conduct your own research before purchasing any cryptocurrencies."
dawidpotocki (Migrated from github.com) commented 2019-08-31 09:38:42 +00:00
Author
Owner

This is really bad idea. If someone will try to translate it, result will make zero sense.
We can't just seperate parts of one sentance.
Also, that "The" is impossible to translate in some languages, pretty much.

This is really bad idea. If someone will try to translate it, result will make zero sense. We can't just seperate parts of one sentance. Also, that "The" is impossible to translate in some languages, pretty much.
erciccione (Migrated from github.com) reviewed 2019-08-31 11:21:37 +00:00
@ -0,0 +256,4 @@
more: "More Cryptocurrencies"
the: "The"
team: "privacytools.io team"
endorse: "does not necessarily endorse all of the cryptocurrencies listed on this page. Please conduct your own research before purchasing any cryptocurrencies."
erciccione (Migrated from github.com) commented 2019-08-31 11:21:37 +00:00
Author
Owner

Why? A translator will have to look for a context anyway and on weblate you can even add the context direcly on the page of the string (as picture or text).

that "The" is impossible to translate in some languages, pretty much.

Translators don't translate a sentence literally, they adapt it to their language. So i don't see any problem with this.

Why? A translator will have to look for a context anyway and on weblate you can even add the context direcly on the page of the string (as picture or text). > that "The" is impossible to translate in some languages, pretty much. Translators don't translate a sentence literally, they adapt it to their language. So i don't see any problem with this.
dawidpotocki (Migrated from github.com) reviewed 2019-08-31 11:30:48 +00:00
@ -0,0 +256,4 @@
more: "More Cryptocurrencies"
the: "The"
team: "privacytools.io team"
endorse: "does not necessarily endorse all of the cryptocurrencies listed on this page. Please conduct your own research before purchasing any cryptocurrencies."
dawidpotocki (Migrated from github.com) commented 2019-08-31 11:30:48 +00:00
Author
Owner

How you want to put in translation empty string?

How you want to put in translation empty string?
erciccione (Migrated from github.com) reviewed 2019-08-31 11:43:07 +00:00
@ -0,0 +256,4 @@
more: "More Cryptocurrencies"
the: "The"
team: "privacytools.io team"
endorse: "does not necessarily endorse all of the cryptocurrencies listed on this page. Please conduct your own research before purchasing any cryptocurrencies."
erciccione (Migrated from github.com) commented 2019-08-31 11:43:07 +00:00
Author
Owner

How you want to put in translation empty string

Why empty string?

how you want translators to know that these are part of one sentence?

Translators can find the context looking at the source string, which they should do anyway if they want their translation to be as accurate as possible and as i said, context can be added on Weblate (they have a native feature) directly when visualizing the string.

> How you want to put in translation empty string Why empty string? > how you want translators to know that these are part of one sentence? Translators can find the context looking at the source string, which they should do anyway if they want their translation to be as accurate as possible and as i said, context can be added on Weblate (they have a native feature) directly when visualizing the string.
dawidpotocki (Migrated from github.com) reviewed 2019-08-31 12:22:45 +00:00
@ -0,0 +256,4 @@
more: "More Cryptocurrencies"
the: "The"
team: "privacytools.io team"
endorse: "does not necessarily endorse all of the cryptocurrencies listed on this page. Please conduct your own research before purchasing any cryptocurrencies."
dawidpotocki (Migrated from github.com) commented 2019-08-31 12:22:45 +00:00
Author
Owner

Why empty string?

Because "The privacytools.io team" would be translated to "Zespół privacytools.io" in Polish, there is no "The". So it has to be empty.

> Why empty string? Because "The privacytools.io team" would be translated to "Zespół privacytools.io" in Polish, there is no "The". So it has to be empty.
erciccione (Migrated from github.com) reviewed 2019-08-31 12:27:30 +00:00
@ -0,0 +256,4 @@
more: "More Cryptocurrencies"
the: "The"
team: "privacytools.io team"
endorse: "does not necessarily endorse all of the cryptocurrencies listed on this page. Please conduct your own research before purchasing any cryptocurrencies."
erciccione (Migrated from github.com) commented 2019-08-31 12:27:30 +00:00
Author
Owner

Ok, i guess you are referring to the The two strings above. In that case i agree, only one variable should be used: team: "The privacytools.io team".

Ok, i guess you are referring to the `The` two strings above. In that case i agree, only one variable should be used: `team: "The privacytools.io team"`.
Mikaela (Migrated from github.com) reviewed 2019-09-05 16:01:23 +00:00
@ -0,0 +256,4 @@
more: "More Cryptocurrencies"
the: "The"
team: "privacytools.io team"
endorse: "does not necessarily endorse all of the cryptocurrencies listed on this page. Please conduct your own research before purchasing any cryptocurrencies."
Mikaela (Migrated from github.com) commented 2019-09-05 16:01:23 +00:00
Author
Owner

This may not be helpful this late, but Finnish and Czech don't have "the" either, in Swedish it would be a part of the word (vatten = the water IIRC) and some languages like Spanish have two different word for it, masculine and feminine, I am not sure if there is also neutral.

This may not be helpful this late, but Finnish and Czech don't have "the" either, in Swedish it would be a part of the word (vatten = the water IIRC) and some languages like Spanish have two different word for it, masculine and feminine, I am not sure if there is also neutral.
djoate commented 2019-11-03 02:36:29 +00:00 (Migrated from github.com)
Author
Owner

I'm sorry, @JonahAragon but it looks like my merging of master into i18n closed this PR and its associated issue, https://github.com/privacytoolsIO/privacytools.io/issues/1106. Could you see if you can reopen the PR and the issue?

I'm sorry, @JonahAragon but it looks like my merging of master into i18n closed this PR and its associated issue, https://github.com/privacytoolsIO/privacytools.io/issues/1106. Could you see if you can reopen the PR and the issue?
Author
Owner

@djoate oh. No, that was my mistake. Earlier I merged your PR into the master branch of the actual repository 😳 — I undid that little mistake but didn't realize that it had closed this PR too. I don't think I can reopen this so I'll make another PR.

@djoate oh. No, that was my mistake. Earlier I merged your PR into the master branch of the actual repository 😳 — I undid that little mistake but didn't realize that it had closed this PR too. I don't think I can reopen this so I'll make another PR.
This repo is archived. You cannot comment on pull requests.
No reviewers
No Milestone
No Assignees
1 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: privacyguides/privacytools.io#1105
No description provided.