-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add i18n for include_blank #616
Conversation
Hey mate! This pull request seems good but I want to propose this feature to be added directly in Rails. See #176 (comment) What do you think? |
Yep that makes sense to me. I'll submit one over there! |
Lets leave this one open until the Rails one is accepted. |
Ok having looked at how this works in Rails, I've changed my mind. Doing the translations in Rails means that they apply to all selects.
The big advantage to translating both en:
simple_form:
include_blank:
person:
age: "Prefer not to say"
car: "No car"
prompt:
car:
make: "Choose your car's make:"
color: "Paint your car:" I think this is better than having to specify these options every time you make an input for that attribute. What do you reckon? |
I'm fine with doing this in SimpleForm. @josevalim @carlosantoniodasilva thoughts? |
I'm ok to add this to SimpleForm itself, no problem. So in short, we're going to always lookup for @haines can you please also add tests to ensure that when giving Thanks. |
@carlosantoniodasilva Yep that's pretty much right. The user can still specify |
Alright. I'm just a little bit worried about extra translation lookups we'll be doing for free now, for those who use |
I don't think it makes sense to translate when
In other words, I believe we just need to change this pull request to translate only prompt values. If we do that, everything else should work as expected. |
I think it does make sense for
In those cases it can sometimes be better to have
|
Any more thoughts on this, guys? |
I still not sure, but I think this feature should be opt-in. So users that doesn't want it will not have to do a i18n lookup |
Yeah, makes sense! How about this: If If That would avoid doing lots of extra unexpected lookups. |
This sounds like an easy way out but I find it confusing because you end up having three values: nil (i.e. the default), true (translation) and false (skip it). I would prefer |
Yeah, could work - I like the idea of being able to choose a key. I'll knock something up tomorrow. |
but how |
I think it would be equivalent to Or perhaps even better, it could be |
Ok, I have changed it so that all lookups are opt-in. The current behaviour is maintained:
The new behaviour is:
Similar options apply for |
+1. It would be great to have it |
👍 |
1 similar comment
+1 |
I think we should get rid of the |
So its been over a year and still no I18n placeholder support for selects??? WTF! This is an extremely basic feature and according to the current docs one would believe it is supported. The documentation makes no mention that i18n placeholders are not supported for selects even though they are for other fields. I've just wasted an hour tracing and debugging something that turns out to be a silent limitation of simple_form. These kinds of WTF moments make me wonder what all the added complexity in "simple form" is about. I've had grief with simple form handling of select options (eg passing extra data attributes on options), rails does it and simple_form with all its complexity doesn't. Thank god I'm moving away from convoluted server rendered form nonsense, and far away from year long bike-sheds with no outcomes. |
@ahacking feel free to add this feature right now. |
@dreamfall Why? So we can have another year of bikeshed and nothing making it into master? As I said I have since migrated away from server side rendering and the need for simple form and its many unwanted surprises and deviations from what the documentation would have you believe. |
@ahacking ❤️ 💚 💙 💛 💜 |
@ahacking 💚💛❤️💜💙💚💛❤️💜💙💚💛❤️💜💙💚💛❤️💜💙💚💛❤️💜💙💚💛❤️💜💙💚💛❤️💜💙💚💛❤️💜💙💚💛❤️💜💙💚💛❤️💜💙💚💛❤️💜💙 |
👍 |
Add i18n for include_blank
For a collection select input,
:include_blank => "string"
gives<option value="">string</option>
.This patch allows the user to specify a locale file like
in order to automatically translate
:include_blank => true
into:include_blank => "not applicable"