Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add translation support #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

scribblemaniac
Copy link
Member

@scribblemaniac scribblemaniac commented Nov 19, 2021

Translation Example

This adds full translation support to the website, with a simple language switcher in the toolbar. Most pages must be duplicated under _translations/ and then translated. There are also lines in _translations that have to be translated and some lines in _config.yml that have to be changed to add a language. Then Jekyll/Liquid's templating features will automatically update links to match the current page's language. All of this is handled at build time, with the exception of the 404 page which needed to be handled client-side due to Jekyll limitations. One of the big drawbacks of this approach is that building the website now takes dramatically longer (up to 2 minutes on my computer compared with the 4 seconds before this PR). However I think that this is still reasonable and is the best way to support translations without making much more dramatic changes. Unfortunately there is not really anything I can think to do to optimize this further given the limitations of Jekyll and Github Pages.

I also made various small changes along the way as I came across them. I know it's not very good progress but seeing spelling mistakes here and there I just couldn't resist 😳. I also modified some of the layouts and removed the comments: true/false from the front matter and just disabled comments across the entire site with the default values. I thought that we agreed previously to get rid of these since they are very difficult to moderate, but they were only ever disabled on certain pages until now.

I've also included a partial French translation just to demonstrate how it works, although it is hidden unless its line in _config.yml under supported_languages is uncommented. I don't consider myself fluent in French, and I didn't put much effort into it, so it should not be added to the supported_languages list officially until someone more qualified reviews and finishes it.

I will write a full translation guide for potential contributors on a wiki page after these changes are merged.

Closes #16

The approach to translation support that I used was mostly based off of a blend of https://www.usecue.com/blog/multilingual-jekyll-websites/, the github source for that website, and https://www.kooslooijesteijn.net/blog/multilingual-website-with-jekyll-collections, with some personal touches 😉 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs Review
Development

Successfully merging this pull request may close these issues.

Accept translations
2 participants