mmistakes / jekyll-theme-skinny-bones

A Jekyll starter with a variety of flexible layouts and components.
https://mmistakes.github.io/jekyll-theme-skinny-bones
MIT License
804 stars 906 forks source link

Static localization support #48

Closed yonojoy closed 8 years ago

yonojoy commented 9 years ago

Allow static localization of some hardcoded texts

yonojoy commented 9 years ago

OK, I prepared a pull request. I am new to git/github and found no other way to only select the changes for static-localization-support, than to create a new branch and undo the other changes I made to my master branch. I hope it is okay that way?

mmistakes commented 9 years ago

I'll take a look and see how things look. The only bit that might need adjusting is the modifications made to main.js. That file is generated from a Grunt task so the YAML Front Matter would have to be added there I believe. Because if anyone ever modifies the source _main.js file it will overwrite what you did to main.js.

Will have to test because I'm not sure if inserting YAML into _main.js will break things as far as the minification/uglifier Grunt tasks are concerned.

mmistakes commented 9 years ago

@yonojoy Had a chance to quickly test this out and its looking really good. Only issue I see is finding a way to include {{ site.data.messages.locales[site.locale].overview }} and the blank YAML Front Matter in _main.js so it can be uglified with grunt uglify or grunt scripts. Those tasks are stripping out the ---. I'll have to poke around and see if there is a way to force it through.

I like what you did with messages.yml, I had no idea you could do the referencing in YAML as you did for en_US and en_UK. Very smart stuff :smile

yonojoy commented 8 years ago

I don't fully understand how _main.js is generated. But I think replacing Overview with {{ site.data.messages.locales[site.locale].overview }} should not be a problem? Regarding the YAML Front Matter: maybe adding a grunt concat task and an empty YAML Front Matter file might help? However I wont have time to look much deeper into it atm.

mmistakes commented 8 years ago

That's correct. {{ site.data.messages.locales[site.locale].overview }} replacing Overview works just fine. Looking to find a way to keep the YAML Front Matter intact. The Grunt uglifier tasks strips all of that stuff out. I'm sure there's a way to do it just need to investigate.

mmistakes commented 8 years ago

Thanks @yonojoy for your work on this. I figured out how to append the blank YAML Front Matter header to _main.js after it was processed. Just had to add a new Grunt task to do it.