jekyll-multiple-languages-plugin
jekyll-multiple-languages-plugin copied to clipboard
Is it possible to translate objects in front matter?
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).
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.
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)
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