raviriley / agency-jekyll-theme

Jekyll version of the newest Agency Bootstrap theme, plus new features: Google Analytics, Markdown support, custom pages, and more!
https://raviriley.github.io/agency-jekyll-theme-starter/
MIT License
347 stars 689 forks source link

Multiple Language Support #2

Closed raviriley closed 2 years ago

raviriley commented 4 years ago

Is your feature request related to a problem? Please describe.

It would be nice to have support for languages besides English (US).

Describe the solution you'd like

Multiple language support with the use of a sitetext.yml file with different locales, or other implementation.

Additional context

@mmistakes has done a great job of this on his themes. Example

raviriley commented 3 years ago

Spanish has been added by @rbenitezpagan

jackievaleri commented 3 years ago

The Spanish language modification broke backwards compatibility in my repository (forked from the starter-theme). I had to go to an older commit and manually copy over the includes/ .html pages so they would work with my current website, as I customized the names of my sections. I have no problems now, but just figured you would want to know!

Edit: if you want to see the changes I made, they're not in "my" repository, they're in this one: https://github.com/mitharvardwai/mitharvardwai.github.io

rbenitezpagan commented 3 years ago

The Spanish language modification broke backwards compatibility in my repository (forked from the starter-theme). I had to go to an older commit and manually copy over the includes/ .html pages so they would work with my current website, as I customized the names of my sections. I have no problems now, but just figured you would want to know!

Edit: if you want to see the changes I made, they're not in "my" repository, they're in this one: https://github.com/mitharvardwai/mitharvardwai.github.io

@jackievaleri Thanks for sharing, I have submitted PR (https://github.com/raviriley/agency-jekyll-theme-starter/pull/2) on the template repo.

If you have time please test it, it should work after adding your customization.

raviriley commented 3 years ago

Good catch, I forgot to update the template repo. Thanks @jackievaleri for commenting and @rbenitezpagan for the quick fix!

raviriley commented 3 years ago

Just to keep references to everything in one place, merged #2 from agency-jekyll-theme-starter.

raviriley commented 3 years ago

@jackievaleri does everything work as expected?

jackievaleri commented 3 years ago

Yep, everything is working great for me! Thanks so much for your help!

raviriley commented 3 years ago

Great, thanks for the fast responses everyone!

lumpidu commented 3 years ago

How can you toggle between different languages ? Is this based on the browser locale or how is switching implemented ?

rbenitezpagan commented 3 years ago

@lumpidu there's a locale variable on the config file.

lumpidu commented 3 years ago

@rbenitezpagan: but maybe the user of the website wants to choose the language ?

rbenitezpagan commented 3 years ago

@lumpidu Oh, I get what you mean now.

It is not "internationalization" is just having multiple languages as part of the theme.

https://polyglot.untra.io/

lumpidu commented 3 years ago

Aha, but could it be made possible (probably not very production-ready ... I know, just to enhance my understanding) like this:

raviriley commented 3 years ago

Something like that would be possible @lumpidu. However, you would probably want to set two different configs (so two separate implementations of the theme) so that the domains look something like yoursite.com/en/... and yoursite.com/OTHER_LOCALE/....

lumpidu commented 3 years ago

@raviriley : understood. Thx. for clarification !

BeneHa commented 2 years ago

I stumbled upon this as well today and want to clarify it a bit because it took me some time to figure out what was meant by the explanations above. Basically I created separate folders at the top level for the languages (en, de etc.) which only include the index.md. In the index file, just add "locale: en" in the line below "layout: home". Then search and replace "site.locale" for "page.locale" in all files and now you can add your languages in the "_data/sitetext.yml". The will be accessible as "homepage.com/en" etc. so you can create a dedicated language switcher. I still have to figure out how to do it for the portfolio but I am sure there will be a way as well.

Hope this helps someone in the future :)