i18n icon indicating copy to clipboard operation
i18n copied to clipboard

Why I18n.translate method accepts null values but no empty string?

Open pedrocss opened this issue 12 years ago • 3 comments

If translate method raise an exception with empty string, so nil key should raise too?

This works: > I18n.t(nil) "translation missing: pt-BR.no key" but this not: > I18n.t("") I18n::ArgumentError: I18n::ArgumentError

See also: https://github.com/svenfuchs/i18n/blob/master/lib/i18n.rb#L151 https://github.com/svenfuchs/i18n/pull/136

pedrocss avatar Jun 12 '13 14:06 pedrocss

I think you're right, nil key should raise an I18n::ArgumentError. Pull requests welcome, just sayin' :)

On 12 Jun 2013, at 16:24, Pedro Souza [email protected] wrote:

If translate method raise an exception with empty string, so nil key should raise too?

This works:

I18n.t(nil) "translation missing: pt-BR.no key" but this not: I18n.t("") I18n::ArgumentError: I18n::ArgumentError

See also: https://github.com/svenfuchs/i18n/blob/master/lib/i18n.rb#L151 #136

— Reply to this email directly or view it on GitHub.

tigrish avatar Jun 13 '13 20:06 tigrish

:+1:

ahmetabdi avatar Mar 17 '15 09:03 ahmetabdi

This will be fixed by #236.

radar avatar Nov 17 '16 22:11 radar