Skip to content

Conversation

@alloystorm
Copy link

This is an enhancement or feature.

Summary

By using the locale tag from the page, it allows different language pages on the same site.

Context

Previously it only allows a site to have only one language, which limits the ability to create multi-lingo sites.

With this proposed change, the pages are rendered using the locale tag from the page front matter, so that you can create pages for different languages on your website.

@alloystorm
Copy link
Author

I have my website running with this change.

For example this page: https://vrstormlab.com/dancexr/
Click on one of the language links below the title and you'll land on a new page with the same content but for a different language. The locale and lang tags are set correctly for each page so that the browser can recognize.

@iBug
Copy link
Collaborator

iBug commented Apr 22, 2024

I don't think page.locale propagates from site.locale. This means existing users who don't have proper page.locale will suddenly find their site back in English. If the fallback to site.locale is taken care of, I'll be OK with this PR.

@iBug
Copy link
Collaborator

iBug commented Jun 21, 2024

Here's my new idea: Since all templates end up being rendered in default.html, we can assign our desired variables in default.html and use it everywhere. Something like:

<!-- _layouts/default.html -->
{% assign locale = page.locale | default: site.locale %}

<!-- everywhere else -->
{{ site.data.ui-text[locale].blahblahblah }}

If you'd like to proceed, consider taking this approach or we can discuss another idea that you find better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants