Closed rubyconvict closed 14 years ago
UPDATE: My first impression was that it works when hardcoded, but I can't really figure out how this is better than just writing a separate page in another language, could you elaborate on this or give some practical example, more than this: Some {{['default', 'translation'] | t}} text. How do I mix oneliners with whole page translations?
Fixed filter to work with Liquid. [Closed by 3aecb613bc9c398fe28479bfbd6a053cd17a74c5]
sorry, the example didn't work at all because i'm not familiar with liquid by any stretch ;-) but it should be fixed now. thanks for reporting this issue!
as for the rationale: we use it for example in code or layout heavy pages where you don't want to replicate everything in another file just to translate a single word or sentence.
cheers jens
Thanks. I get no error now. This makes sense. So lets say I want to translate a single word with a filter or any other way you do: {{ t: word }}
where and how syntactically do I put the translation for it? in separate yaml file, in yaml header of the translation file with .en.html extension? Sorry, but somehow I can't figure out how to do this.
this is how you do it: {{ 'hi' | t: 'cześć' }}
. that is, 'hi' is the word you want to translate and 'cześć' is the translation. in this case you would set Localization::LANGUAGES to 'en' + 'pl' and configure the page to have either of those languages (e.g. by choosing an appropriate file extension as you mentioned).
hope that helps. i know that we are pretty short on examples and documentation ;-)
I know, when I put {{ 'hi' | t: 'cześć' }} in post.html or in post.en.html i get hi, the t: 'blabla' part is always blank
it uses the translation appropriate for the current page. i.e. if you set Localization::LANGUAGES.replace(%w[en pl])
in your ext.rb and put {{ 'hi' | t: 'cześć' }}
inside post.pl.html you get 'cześć' in the output. does that answer your question?
You mean: Jekyll::Localization::LANGUAGES.replace(%w[en pl]) Yay! That's what I needed. Thank you for helping me out and sharing this plugin of course. Cześć ;-)
yeah, thanks. i fixed the readme. great that you got it working!
proszę bardzo ;-)
The problem is here. It works when I hardcode "en" in localization.rb:
$ cat _extensions/_plugins/ext.rb require 'jekyll/localization'
i have the same problem when i put ext.rb in MYJEKYLLAPP/_plugins.
Please fix it if you can.
My gems: jekyll (0.7.0) jekyll-localization (0.0.3) jekyll-rendering (0.0.2) jekyll_ext (0.1.2) liquid (2.2.2) maruku (0.6.0)