Skip to content
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

Should underscore pass the method name normalization? #19

Open
JoeDupuis opened this issue Apr 30, 2020 · 0 comments
Open

Should underscore pass the method name normalization? #19

JoeDupuis opened this issue Apr 30, 2020 · 0 comments

Comments

@JoeDupuis
Copy link

I have locale fr for France and locale ca_fr for Canadian French.

When I try:

i = GiInspection.new
i.full_name = :en
i.full_name_fr = :also_ok
i.full_name_translations   #=> {"en"=>"en", "fr"=>"also_ok"}
i.full_name_ca_fr = :not_ok
Traceback (most recent call last):
        1: from (irb):7
NoMethodError (undefined method `full_name_ca_fr=' for #<GiInspection:0x00007f126993e978>)

# Removing the underscore seems to work:
i.full_name_cafr = :works
i.full_name_translations #=> {"en"=>"en", "fr"=>"also_ok", "ca_fr"=>"works"}

It comes from the locale normalization in the method generation :
https://github.com/cfabianski/json_translate/blob/master/lib/json_translate/translates.rb#L30

Wouldn't it be better if the normalization pass accepted underscores?

Maybe not at this point as it might breaks some apps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant