dialect-app / dialect

A translation app for GNOME.
GNU General Public License v3.0
596 stars 69 forks source link

ERROR:root:Invalid Lang Code: Invalid target language #289

Closed linsui closed 1 year ago

linsui commented 1 year ago

I got ERROR:root:Invalid Lang Code: Invalid target language with lingva if the target language is Simplified Chinese.

rafaelmardojai commented 1 year ago

We save the recent langs in a per service settings, and looks like be have a bug that makes the previous selected backend to corrupt the new one when switching translators.

This means that you have the Google lang codes for Chinese ('zh-CN', 'zh-TW') that differ form the Lingva ones ('zh', 'zh_HANT'). You can fix this for now by searching for Chinese in the lang selector, that will bring the actual Lingva codes to the list.

linsui commented 1 year ago

The workaround works. Thanks!

linsui commented 1 year ago

I thought it makes more sense to map the language code between different backend. Since Lingva is just a fromtend of Google Translation they support same languages.

rafaelmardojai commented 1 year ago

I thought it makes more sense to map the language code between different backend. Since Lingva is just a fromtend of Google Translation they support same languages.

Yes, maybe, but we also have LibreTranslate, it also has different lang codes for Chinese and different languages. So the simplest approach to avoid issues between translator was to separate the recent languages. This is a regression, probably introduced in 2.0.

I guess we can make some changes in the future to allow global saved recent langs, along with some lang codes normalization.