Closed kekkorider closed 6 years ago
Not currently! But that makes sense. We could add an option like defaultLocale
that copies a specific locale to the root folder.
That would be great! Version 2 works really well but how it exports translated pages is a bit "unconvenient" at the moment.
Anyway, I found a custom solution with another gulp package, I'll post it here during the weekend so other people don't have to get crazy.
Thanks!
Version 2 works really well but how it exports translated pages is a bit "unconvenient" at the moment.
Any other ways you think it could be improved?
I'll try to be as clear as possible.
At the moment Panini v2 exports the pages into the /dist/[LANG]
folder; in my opinion this is not the typical use case because a website with multiple languages has the default language in the root folder and all the other languages under their respective subfolders.
At the moment the folder structure looks like this:
A possible solution might be moving all the content inside the /dist/[DEFAULT_LOCALE]
folder into the /dist
folder, so that when I visit the website (or the dev server starts) I can see my website into the default language.
This is what I'm actually doing with my project:
/it
folder removing the initial ../
and move them up one folder, all using the gulp-url-replace plugin/dist/it
folderThis of course can be done with a bit of custom work, but it would be great if Panini could handle it by itself.
[EDIT]
This would be the exact behavior of the defaultLocale
option you mentioned.
This is the way I have created one multilingual site with Panini - www.ilicdent.tom
I have explained on forums the process for that in this topic http://foundation.zurb.com/forum/posts/49731-multilingual-website-and-paninis-built-in-root-variable
[EDIT] This would be the exact behavior of the defaultLocale option you mentioned.
@kekkorider Yep, I think we're in agreement on how it should be implemented 👍
Implemented in 85cef154e6719764401b9d2dc1b81ea6c1c0b73a, can you see if this works the way you'd expect? Just add "defaultLocale": "it"
to your Panini config in package.json
.
@gakimball excellent, it works like a charm!
I tested a bit adding subfolders and random stuff, all paths are correct and nothing breaks, also the {{root}}
variable behaves as it should.
Side note: the defaultLocale
option must be added to the panini call in gulpfile.babel.js
, not in package.json
.
Thanks a lot, this will save me a lot of time in future projects!
Side note: the defaultLocale option must be added to the panini call in gulpfile.babel.js, not in package.json.
Ah right, yeah. You can actually do either, the package.json
method will be more for people using the CLI.
Glad I could help! 👍
2.0.0-alpha.2
defaultLocale not working for me.
My settings:
gulp.task('views', () => {
panini()('app', {
'defaultLocale': 'cs'
})
.pipe(gulp.dest('.tmp'))
.pipe(reload({stream: true}));
});
My index page is still in cs
subfolder.
I'm developing a website with 2 languages (Italian and English) but I would like to export all the Italian pages to the root folder instead of the
/dist/it
folder and also the entire/dist/en
folder to the root, in order to be able to reach the website from www.mywebsite.com and www.mywebsite.com/en.Is there a way to do so?