Skip to content

i18n Support via Polyglot #504

@ctsstc

Description

@ctsstc

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 🤞

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions