-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i18n lazy lookup #272
Comments
Cool idea - I don't think you have to configure that. You have to override the class Cell::ViewModel < ..
def t(name)
super "en.bla.#{name}"
end
end I am not sure where to get all the information you need for this string (e.g. |
Oh, that totally makes sense. I'm sure i'll send a PR soon :) On 14 April 2015 at 09:11, Nick Sutterer [email protected] wrote:
|
Ok so that's how that method should look like:
but to be honest i have no idea where to put that. Cells code is a bit too complex for me so i probably don't understand something nor where that should be implemented. I've tried all probable places in Cell::ViewModel without any luck. Sorry for being dumb! |
It's really simple: every instance method in a cell class is available as a "helper" in the view. That means you can simply put it into This is cool! I like it! Can you PR? Just put that code into |
Hello!
I'm using cells for some time and i'm pretty glad with how it works. However, one thing bothers me - i'm not able to use shorter version (aka lazy lookup) of my i18n keys when translating a text inside my cells. It's actually pretty obvious because these shorter forms are meant to be used with regular controller/view/partial entities but i was thinking - wouldn't that be lovely to make it able to use it with cells using some generic scheme? For example, if user uses
t('.label')
inside ashow.erb
cell view ofUserWidgetCell
, it should display a translation fromen.cells.user_widget.show.label
.That would be amazing to be able to use
.label
instead of that whole chain, just like in regular rails views. I would love to make a PR but i have searched everything and i'm not able to figure out how to configure such thing in rails.The text was updated successfully, but these errors were encountered: