Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

i18n support/key for prompts #176

Closed
dpickett opened this Issue Jan 26, 2011 · 15 comments

Comments

Projects
None yet
7 participants

I went to add a key for simple_form.prompts.model_name.attr but there isn't support for it - happy to write a patch if you think this is a good idea. Let me know.

Collaborator

carlosantoniodasilva commented Jan 26, 2011

I guess I didn't follow what you mean. Do you want to add translated prompts for select boxes by default? Right now you can already use a translated prompt for all selects, do you want do have different prompts for each attribute?

right, a different prompt for each attribute so that for a country select I could have "Please select a country" and for state I could have "Choose a state" - I know I can assign them by string but I figured it would be cool to have them available via i18n

Collaborator

carlosantoniodasilva commented Feb 4, 2011

The main idea sounds good to me. You'd have to do some work on collection select, only for the :select type, to make it work. Please let me know if you have some doubt and feel free to send a pull request. Thanks.

Collaborator

carlosantoniodasilva commented Mar 2, 2011

Hey mate, are you still interested on creating a patch for this? Please let me know, otherwise I'll close this issue. Thanks.

Owner

josevalim commented Apr 6, 2011

I think this patch would actually be a good fit for Rails.

Collaborator

rafaelfranca commented May 17, 2011

I'm closing this issue. Please, send us a pull request if you want this feature.

RKushnir commented Jun 6, 2012

So where do we are on this? Still not implemented? simple_form.prompts seems not working.

Owner

josevalim commented Jun 6, 2012

I would instead propose this feature to rails. Whenever passing :prompt => true it could do a I18n lookup, there is no reason to be tied to simple form.

Collaborator

carlosantoniodasilva commented Jun 6, 2012

@nashby yeah, it does but it's for a single value, but I think the idea is to implement it per model/attribute as labels for instance. Thanks :)

Collaborator

nashby commented Jun 6, 2012

@carlosantoniodasilva I see. I think I can try to implement it. :)

mbhnyc commented Sep 17, 2012

+1 on this - basically I was hoping to store symbol translations once, but need to look them up in show actions (they were in the model before, but i like this better) — is there another way to do it that I'm missing @nashby / @carlosgaldino?

mbhnyc commented Sep 17, 2012

Nevermind: I18n.t(:"simple_form.labels.user.#{f.to_s}") where f is the symbol for your field.

@mbhnyc Just a tip, you can change your code to I18n.t(f.to_s, scope: 'simple_form.labels.user') to avoid string interpolation.

mbhnyc commented Sep 18, 2012

Ah! Thx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment