-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
arrays and front-matter variables #57
Comments
I think you need to do |
That also does not work. In my case, I have an array of objects stored in an external file as follows. books.yml
I want to do
This #each helper just outputs an empty block, without even rendering By the way, having to define a variable in YFM for each array I want to use is really cumbersome. It'd be nice if we could do something like just |
The issue is that sometimes you need a string in a specific language, not necessarily the language of the page, that's why it is the way it is but we could have another variables to point to the current language object. Any idea? |
@LaurentGoderre out of curiosity, in your projects, is there something you can point me to that shows how the languages created/formatted or otherwise converted to data so they can be used in templates as context? |
We use a CSV that is then converted to the right data https://github.com/wet-boew/wet-boew/blob/master/src/i18n/i18n.csv |
Although I would much prefer to handle this through Transifex |
great, thanks for the info. I'm going to look into it a bit, hopefully I can make some of this easier in assemble. |
The biggest issue I saw with this and assemble is when using the function like navigation. I had to preprocess the front-matter for all files to make sure the i18n substitution was happening other wise I would get this for the first file
Link 1 And so on |
yeah, I think that would be expected with front matter in general - since that data won't be on the context until it's actually parsed. with 0.6 this is a lot easier, and we have several options to ensure you don't have that issue anymore. let me know if you want to review sometime |
I have this set up so that I can call strings with the i18n helper, but I need to figure out how to handle front-matter variables on a page, and iterating over arrays of data.
Is there a standard/assumed way of doing this?
I want to achieve something like the following:
This of course overwrites the en/fr variable so all the other keys are lost and the build fails. My assumption is I need to set these translations in the
i18n\en.yml
etc?Then how do I handle, say, an array in my data using
{{each}}
? I can't pass a helper to a helperIs the key to do
fruits: <%= i18n.fruits %>
in the front-matter? that doesn't seem to be working...The text was updated successfully, but these errors were encountered: