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

i18n Support via Polyglot #504

Open
ctsstc opened this issue Mar 6, 2024 · 1 comment
Open

i18n Support via Polyglot #504

ctsstc opened this issue Mar 6, 2024 · 1 comment

Comments

@ctsstc
Copy link

ctsstc commented Mar 6, 2024

I've been using https://github.com/untra/polyglot as it seems to be the last maintained i18n implementation.

Since I'm rather new to Jekyll, it seems that you cannot utilize dynamic variables in front matter since it's utilized for static content.
I did find this random comment that was related 😆 #494 (comment)

My Example

I've been defining i18n content in /_data/en/pages/some_page.yml

I'm then able to pull the content in a template like so and have it pull the current language from the data definitions.

---
title: Some Page
---
{% assign t = site.data.pages.some_page %}
<div>
  <h1>{{ t.header}}</h1>
  <p>{{ t.sub_title }}</p>
</div>

Proposal

I'm not sure if something like this would be possible since you cannot put dynamic content into the front matter, but it could surely help the situation if we could do something like this instead:

{% assign t = site.data.pages.some_page %}
{% assign title = t.title %}
<div>
  <h1>{{ t.header}}</h1>
  <p>{{ t.sub_title }}</p>
</div>

I'm really hoping something like this would be possible 🤞

@boamaod
Copy link

boamaod commented Jan 24, 2025

I'm just adding to thematically related issue, that it seems currently the only way to translate site title is to modify the templates as described here. Editing templates for just translation purposes is not a very good practise in itself, but it is also limited, because og:site_name will still remain untranslated, since there is no way to override it in a way similar to title.

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

No branches or pull requests

2 participants