-
-
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
i18n
helper inside each
helper results in: The 'language' parameter is not defined
#61
Comments
@rauberdaniel Thanks for the issue! If you're reporting a bug, please be sure to include:
|
This is due to the nature of handlebars. The {{#each press.releases}}
<li class="press-release">
<h3>{{i18n title language=../language}}</h3> <!-- Should use the title of the press release as the translation key -->
</li>
{{/each}}
`` |
@LaurentGoderre Thank you for your help! By doing this I receive a |
i18n is a bit complicated. There is the handlebars helper that allows to output translated strings and independently but related the assemble extensions allow to create several language pages using a common template. I'm not sure which part is failing. Are you using the both or just the handlebars helper? Also, do you have a repo I can see? |
if |
When was |
haha, you might want to sit down @LaurentGoderre. I believe |
At least I know now |
@jonschlinkert No, @LaurentGoderre Actually I think that I’m only using the helper, which probably would mean I’m totally wrong here, right? 😕 |
I just logged the page context and the |
I vaguely remember there was a way around this issue where you could redefine the context. It might be easier to investigate if there is a way to look up the chain for the translation but I remember not being able to last time I looked into it |
Can you try this: {{#each press.releases}}
<li class="press-release">
<h3>{{#with ..}}{{i18n title}}{{/with}}</h3> <!-- Should use the title of the press release as the translation key -->
</li>
{{/each}} |
@LaurentGoderre Haven’t tried it yet but I guess the problem there will be that Instead of putting the translations in {
"releases": [
{
"date": "2016-03-16",
"de": {
"title": "Deutscher Titel",
"teaser": "deutsch…"
},
"en": {
"title": "English Title",
"teaser": "english…"
}
}
]
} |
That is a crafty way! I never thought of doing it this way |
I really like it! |
how to use {{#with}} in nested loops??? It doesn't work. PLease help |
I am trying to use the
i18n
helper inside aneach
helper loop. However, trying to do this will result in:Warning: The 'language' parameter is not defined Use --force to continue.
. Maybe this is some issue about the scope?I’m using
[email protected]
and[email protected]
Note: It also does not work if I use a fixed string as translation key, e.g.
{{i18n "site.title"}}
.The text was updated successfully, but these errors were encountered: