Comments (6)
I encountered this too but I forgot how I solved it! The problem is that Assemble processes page in order and only do the replacements when rendering the page. What you are seeing is that the translation works for page that have been processed before that current page but the ones after have not yet been replaced.
from grunt-assemble-i18n.
Ok, so how I fixed this is I created a custom plugin registered on the render:pre:pages
stage loops through all the page and perform the replacement manually for the title. It kinds of bypass this plugin just for titles.
from grunt-assemble-i18n.
Do you maybe have an example of this custom plugin?
from grunt-assemble-i18n.
Here is the plugin I wrote for this:
/**
* postprocess
* @param {Object} params
* @param {Function} callback
*/
var async = require('async');
var _ = require('lodash');
var options = {
stage: 'render:pre:pages'
};
module.exports = function (params, callback) {
'use strict';
var assemble = params.assemble;
var grunt = params.grunt;
var options = assemble.options.permalinks;
var pages = assemble.options.pages;
async.forEach(pages, function(page, next) {
// TODO: traversal of the data object to expand more than just the title property
page.data.title = _.template(page.data.title)(page.data);
grunt.verbose.ok('Pre-processed:'.yellow, page.dest);
});
callback();
};
module.exports.options = options;
from grunt-assemble-i18n.
sorry for the late answer. wasn't able to try it until now but this works. thank you!
from grunt-assemble-i18n.
hey, i have the same problem but i don't know how to build this plugin. Do you can explain how i can use your plugin? would be greatly appreciated.
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
- Moving to `grunt-assemble-i18n` HOT 2
- `i18n` helper inside `each` helper results in: The 'language' parameter is not defined HOT 16
- 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.