Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Is it possible to translate objects in front matter? #67

Open
pklada opened this issue Jun 13, 2016 · 3 comments
Open

Is it possible to translate objects in front matter? #67

pklada opened this issue Jun 13, 2016 · 3 comments

Comments

@pklada
Copy link

pklada commented Jun 13, 2016

subnav:
  - name: subtitle.overview
    hash: overview
  - name: subtitle.examples
    hash: examples
  - name: subtitle.builder
    hash: builder
  - name: subtitle.resources
    hash: resources

This is something we're trying to do (define the navigation in the front matter) but the 'name' keys here aren't being translated (just shows up as a literal string).

@Anthony-Gaudino
Copy link
Contributor

Hi @pklada, I didn't understand exactly what you want to achieve.

If you want to provide translations on the front matter, then currently this is not possible, the translation tag provided on the plugin only searches on YAML files in the _i18n folder.

So if you use {% t page.subnav[2]["name"] %} it wont return subtitle.builder.

If I misunderstood you, please let me know.

@anroots
Copy link

anroots commented Aug 21, 2016

A use case for this would be to translate key-value attributes in a web-shop site:

---
name: Pineapples
price: 50

As the owner of that hypothetical site, I would like to present my product names in two different languages. The easiest way for me to do that would be to translate the name string in the front matter and that string only (I want to keep things DRY, so duplicating the price attribute would be an anti-pattern)

@ghost
Copy link

ghost commented Feb 27, 2018

hello there, is it possible to access yml files in the language folders (en/es/de/...) and loop the current language versions in the yml file ? Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants