chamnap / liquid-rails

Renders liquid templates with layout and partial support
https://rubygems.org/gems/liquid-rails
MIT License
118 stars 102 forks source link

translate filter support for I18n interpolation #3

Closed tomash closed 9 years ago

tomash commented 9 years ago

First of all, thanks for awesome gem. Saved me a lot of time.

I needed a translate filter that'd accept an arbitrary hash and pass it over to Rails' translate, so that interpolation would work. This PR contains a working implementation.

I'd further suggest removing scope and locale from explicit function params and make everything work as hash: this way interpolation could be used without having to explicitly specifly scope and locale on every translation that needs interpolation vars. But this is a deeper change and I didn't want to change the api in backwards-incompatible way.

coveralls commented 9 years ago

Coverage Status

Coverage increased (+0.03%) to 86.36% when pulling a342654e51f656581e46b88b9b7241276aaa5da7 on tomash:translate-with-interpolation into 199f7b000704522f2381e1ce55de30b15cee1fea on yoolk:master.

chamnap commented 9 years ago

Thanks for this PR. I agree to remove scope and locale.

tomash commented 9 years ago

All right, will do!

chamnap commented 9 years ago

I'll close this PR now. I just implemented it on the master branch, https://github.com/yoolk/liquid-rails/commit/dfcf37ad33789487cfdb5eb304da4bc6abf46091.