Hi,
From the URL in your profile, I guess your Discourse site’s locale is set to Simplified Chinese. I encountered the same issue. The cause of the problem is that Simplified Chinese is coded as “zh_CN” in the site settings, but the key in LocaleSiteSetting is “zh”, leading to a mismatch.
I have created a PR to fix this issue:
discourse:main ← ShuiyuanSJTU:fix/locale_hash
opened 08:30AM - 05 Jul 24 UTC
The latest AI plugin encounters an error when using the editor AI assistant's tr… anslation feature if the site setting or user custom language is set to Simplified Chinese (zh_CN).
I noticed a similar issue being reported on meta: [NoMethodError after upgrade](https://meta.discourse.org/t/nomethoderror-after-upgrade/315073).
The error originates from:
https://github.com/discourse/discourse-ai/blob/d555f18c6fadd4676d70ddd44f0bf63f2a8e8228/lib/ai_helper/assistant.rb#L32
The cause of the problem is that Simplified Chinese is coded as "zh_CN" in the site settings, but the key in LocaleSiteSetting is "zh", leading to a mismatch.
This PR fixes the issue by copying the approach used in Discourse core:
https://github.com/discourse/discourse/blob/bb0daa33cd93eeffb230689d1daacd737f61b2e7/app/models/locale_site_setting.rb#L11
8 Likes