easy_translate icon indicating copy to clipboard operation
easy_translate copied to clipboard

Ambiguity issue of 'zh-CN' vs 'zh' for chinese chars.

Open sagarjunnarkar opened this issue 6 years ago • 2 comments

Issue -> EasyTranslate.translations_available.include?(EasyTranslate.detect('简体中文')) => false

Reason -> EasyTranslate.translations_available returns array with language codes. For Chinese it returns 'zh'

EasyTranslate.detect('简体中文') => 'zh-CN'

But EasyTranslate::LANGUAGES.include?('zh-CN') => true

Why like this? and what is solution?

sagarjunnarkar avatar Jul 27 '18 12:07 sagarjunnarkar

Hello @sagarjunnarkar !

I'm a bit confused about what the issue is here - can you describe a bit more in detail please?

seejohnrun avatar Aug 06 '18 15:08 seejohnrun

@seejohnrun

Chinese translation have 2 codes - zh-CN and zh. This makes confusion. .detect method returns zh-CN for Chinese language. But this code(zh-CN) is not present in list of .translations_available. The .translations_available method have zh code for chinese translation.

I think .translations_available this should have zh-CN too.

OR .detect method should return zh so that below statement will return true. EasyTranslate.translations_available.include?(EasyTranslate.detect('简体中文')) => false.

SagarJunnarkar-Edmodo avatar Aug 06 '18 17:08 SagarJunnarkar-Edmodo