Comments (16)
When was {{log}}
added??? That would have save me some much time and grief!!!!
from grunt-assemble-i18n.
@LaurentGoderre Haven’t tried it yet but I guess the problem there will be that title
also will come from the page context, which would be wrong. However, I found a way which currently works for me:
Instead of putting the translations in de.json
and en.json
I can put the translations for each press release in the press.releases
object itself, e.g.
{
"releases": [
{
"date": "2016-03-16",
"de": {
"title": "Deutscher Titel",
"teaser": "deutsch…"
},
"en": {
"title": "English Title",
"teaser": "english…"
}
}
]
}
from grunt-assemble-i18n.
@rauberdaniel Thanks for the issue! If you're reporting a bug, please be sure to include:
- The version of
assemble
you are using. - Your assemblefile.js (This can be in a gist)
- The commandline output. (Screenshot or gist is fine)
- What you expected to happen instead.
from grunt-assemble-i18n.
This is due to the nature of handlebars. The each
block creates a new context and that context doesn't have a language parameter. A workaround is to specify the language from the parent context.
from grunt-assemble-i18n.
@LaurentGoderre Thank you for your help! By doing this I receive a Warning: No strings found for language 'en' Use --force to continue.
(also when using a fixed string instead of the title
variable (which is definitely available)). Are the given translation JSON files also not available in the new context? Any idea how I can make them available there?
from grunt-assemble-i18n.
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?
from grunt-assemble-i18n.
if title
is on the page context, try doing {{i18n ../title language=../language}}
inside the each block. also, try doing {{log this}}
to see the context inside and outside the block to help debug
from grunt-assemble-i18n.
When was {{log}} added??? That would have save me some much time and grief!!!!
haha, you might want to sit down @LaurentGoderre. I believe log
has been there since the very early days of assemble. but I know the feeling lol
from grunt-assemble-i18n.
At least I know now
from grunt-assemble-i18n.
@jonschlinkert No, title
is in the each
context, so that should be fine. The warning (which maybe should be an error) says that there are no strings found at all for language 'en'… missing just one string would return a different warning (No string for key … for language 'en'
).
@LaurentGoderre Actually I think that I’m only using the helper, which probably would mean I’m totally wrong here, right? 😕
from grunt-assemble-i18n.
I just logged the page context and the each
context and noticed that the translations are actually stored in the de
and en
properties of the page context, which probably is the issue because they do not get passed to the each
context (like the language
property). Any Idea on how to achieve this?
from grunt-assemble-i18n.
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
from grunt-assemble-i18n.
Can you try this:
from grunt-assemble-i18n.
That is a crafty way! I never thought of doing it this way
from grunt-assemble-i18n.
I really like it!
from grunt-assemble-i18n.
how to use {{#with}} in nested loops???
like
{{#each....}}
{{#each....}}
{{#with}}
{{/each}}
{{/each}}
It doesn't work. PLease help
from grunt-assemble-i18n.
Related Issues (20)
- "with-plugin" task fails: No source files found HOT 2
- Add documentation HOT 30
- Warning: The 'language' parameter is not defined HOT 16
- Stack overflow on language in front matter HOT 4
- Out of memory on compilation HOT 26
- Keep folder structure inside language folder? HOT 4
- Complementary plugin (shameless plug :P) HOT 2
- Convert to assemble v0.6.0 HOT 2
- Suggestion: make replacement of page file name optional HOT 18
- Duplicate Navigation generated in within partials HOT 4
- v0.1.3
- README.md cannot be generated using Verb HOT 4
- Allow language files to be divided or data to be nested HOT 6
- language not being set HOT 7
- i18n navigation HOT 6
- arrays and front-matter variables HOT 9
- problem with translation strings for pages HOT 6
- Moving to `grunt-assemble-i18n` HOT 2
- moderate severity security vulnerability on handlebars dependency HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grunt-assemble-i18n.