simple_enum icon indicating copy to clipboard operation
simple_enum copied to clipboard

Enum collection in yml now singular instead of plural

Open jjinkxy opened this issue 6 years ago • 2 comments

I just want to double check, but in the 1.x version it was advised to name the enum collection in the plural form in the i18n yaml file eg.

de:
   enums:
     genders:
       female: 'Frau'
       male: 'Mann'

Now, for 2.x, its advised to name them in the singular form eg.

de:
   enums:
     gender:
       female: 'Frau'
       male: 'Mann'

Is this correct? Otherwise the ViewHelpers wont work?

If so, could this be added to the 1.x-to-2.x-Migration-Guide?

jjinkxy avatar Jun 13 '18 09:06 jjinkxy

@jjinkxy Sorry for the delay, will do my best to have a look at this within the next couple of days 👍

drobny avatar Jun 20 '18 15:06 drobny

Hi @jjinkxy looks like you can use singular or plural case in your localisation file and then use the corresponding singular or plural key when you call the ViewHelpers methods i.e. for your 1.x example enum_option_pairs(User, :genders) which would pick up the plural block in your locale files and similarly for 2.x you would call enum_option_pairs(User, :gender) so it is the way you call the method rather than the restriction of the library.

I appreciate that all the examples in the read me / code use the singular form. If you think it is worth clarifying this in the migration guide / read me feel free to submit a PR 😄

drobny avatar Jun 22 '18 13:06 drobny