i18n: Proposal to use jekyll-simple-i18n plugin instead of jekyll-multiple-languages #1503
Closed
djoate wants to merge 9 commits from
i18n-simple into master
pull from: i18n-simple
merge into: privacyguides:master
privacyguides:master
privacyguides:dependabot/bundler/nokogiri-1.13.6
privacyguides:dependabot/bundler/addressable-2.8.0
privacyguides:freddy-m-patch-3
privacyguides:pr-add_RemoveMyPhone_sponsor
privacyguides:pr-browser_cleanup_1257_1328_1430
privacyguides:freddy-m-patch-2
privacyguides:freddy-m-patch-1
privacyguides:pr-vpn_hated_one_video
privacyguides:cdn
privacyguides:update-nitrohorse-image
privacyguides:promote-metager-to-card
privacyguides:hardware
privacyguides:pr-add_azirevpn
privacyguides:pr-add_mailfence
privacyguides:shop
privacyguides:1673
privacyguides:pr/1658
privacyguides:sponsorship-edits-nov2019
privacyguides:i18n
privacyguides:ipfs
privacyguides:blacklight447-ptio-patch-3
privacyguides:blog
privacyguides:remove-windows-icons
privacyguides:pr/1147
privacyguides:i18n-testing
privacyguides:add-beautify
No Reviewers
Labels
Clear labels
:mag:🤖 Search Engines
approved
dependencies
duplicate
feedback wanted
high priority
I2P
iOS
low priority
OS
Self-contained networks
Social media
stale
streaming
todo
Tor
WIP
wontfix
XMPP
[m]
₿ cryptocurrency
ℹ️ help wanted
↔️ file sharing
⚙️ web extensions
✨ enhancement
❌ software removal
💬 discussion
🤖 Android
🐛 bug
💢 conflicting
📝 correction
🆘 critical
📧 email
🔒 file encryption
📁 file storage
🦊 Firefox
💻 hardware
🌐 hosting
🏠 housekeeping
🔐 password managers
🧰 productivity tools
🔎 research required
🌐 Social News Aggregators
🆕 software suggestion
👥 team chat
🔒 VPN
🌐 website issue
🚫 Windows
👁️ browsers
🖊️ digital notebooks
🗄️ DNS
🗨️ instant messaging (im)
🇦🇶 translations
approved, waiting for a PR
Pull requests that update a dependency file
The Invisible Internet Project (I2P)
Operating Systems
A label for stalebot if it gets added
Anything related to media streaming.
Anything covering the Tor network
active work in progress, do not merge or PR (yet)!
Issues or bugs that will not be fixed and/or do not have significant impact on the project.
Extensible Messaging and Presence Protocol
Matrix protocol
Browser Extension related issues
Correction of content on the website
Firefox & forks, about:config etc.
Anything primarily related to site cleanup.
Virtual Private Network
*Technical* issues with the website.
Domain Name System
Anything covering a translated version of the site
No Label
Milestone
No items
No Milestone
No due date set.
Dependencies
No dependencies set.
Reference: privacyguides/privacytools.io#1503
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "i18n-simple"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Related to issue https://github.com/privacytoolsIO/privacytools.io/issues/1106.
Tagging @JonahAragon since i18n was your project.
Preview of index.html translation: https://deploy-preview-1503--privacytools-io.netlify.com/es/
Original site: https://deploy-preview-1503--privacytools-io.netlify.com
Sample of partially translated pages:
Every other page has not been translated (pages without
translate: truein front matter are not generated)This is not meant to be a full-fledged PR but rather a proof of concept for a better solution for localizing the site. If this is an acceptable solution, please make this into a branch in this repository so that we can start localizing using this plugin.
With the jekyll-simple-i18n plugin (MIT licensed), this makes translating the site easier to manage. You should visit the plugin's GitHub repository and read up on it, but here are the features of this plugin from their README:
It's based on Transifex, but it can be used with a different service such as Weblate. I've made some modifications to the plugin (e.g. renaming transifex to weblate and handling null source text).
This PR includes an example of index.html and a part of card.html (The "Learn More" button text) being translated. The plugin did not seem to work with the github-pages gem, so github-pages was switched with jekyll gem (which is what the current i18n branch does anyway). You can go to https://deploy-preview-1503--privacytools-io.netlify.com/es/ (or build locally) to see the following:
https://deploy-preview-1503--privacytools-io.netlify.com gives the original English site.
Here is a snippet of the source code for index.html:
A snippet of resources.html:
Instead of using keys and two different files, you just wrap the original text around with
{% t ... %}tags, and the plugin will automatically key that string (with its own ID) intoweblate-source-file.yml. If you are trying to translate things inside of a card, you have to do the same thing as before with capturing text.The source YAML is generated on build into the root folder of the repo. This source file can then be copied into
_data/languages/and then renamed into one of the languages in the language map to set up a translation. This seems much easier to maintain compared to cross referencing between two different files.The plugin will also not create multiple keys for duplicates of the exact same string. For example,
{% t Worth Mentioning %}will have one key associated with it, and there will only be one key to translate. All other pages that use{% t Worth Mentioning %}will share the same key (however, I've modified it so that, for instance,{% t Worth mentioning %}and{% t Worth Mentioning! %}would have distinct keys)We would have to replace local links with something like this in order to get the right pages (and I believe external links can be wrapped in
translatetags without a problem):A porition of the source file,
weblate-source-file.yml, looks like this:It's a different format when compared to what is currently in the i18n branch now, i.e. it has the format
rather than
If this format doesn't work with Weblate, we can change the plugin so that it generates the latter format.
A sample translation into Spanish (using deepl.com) can be found in
_data/languages/es.yml:Known issues
https://privacytools.io/es/donatewill have to stay as/es/donatefor now. Update: See comment below since this is actually not an issue.jekyll-sitemapplugin also had to be explicitly added in order for the site to compile.To reiterate, this is a proof of concept for a better i18n solution. Feel free to add this as a branch if this seems like an acceptable solution.
Deploy preview for privacytools-io ready!
Built with commit
1472c2760chttps://deploy-preview-1503--privacytools-io.netlify.com
That's actually a thing I wanted to build :P.
That's good, it's more predictable and easier to implement (like for
example if user would switch language while being on some subpage).
Okay. This looks good to me. A saner solution, I think. We can't use Transifex. If this works with Weblate, which it should, we're fine.
We don't want to add
weblate-source-file.ymlto .gitignore, do we? I think the file would need to be in the repo for Weblate to read it.