Discourse AI translations bug?

I’m encountering some bugs while using Discourse AI. Here’s the situation:
First, let’s look at a correct post to demonstrate that my configuration is not the issue and everything is working as I intended.
My site’s base language is Simplified Chinese, and there are 9 other languages available.
This “New post test 0 translation” post is normal.

However, some individual posts are experiencing issues. For example:
This “About ‘Image Library’ category” post. The original post was published in Simplified Chinese (it was automatically published when the category was created).
But in the translation results, the original Simplified Chinese has been translated into “zh_CN” again, instead of being translated into English.

When I tried to manually add the English translation using the red globe icon, something strange


In the dropdown list, I am unable to add a separate translation for English.
However, in my global settings, English (US) has already been added correctly.

I have disabled the CDN cache and repeatedly cleared the local browser cache.
This rules out caching as the problem.
My basic configuration can also be ruled out, as the first image shows the correct behavior.
I don’t understand why this problem is happening. How can I fix it?
My Discourse version is 3.6.0.beta1-dev(b8e86ceb23)
The server OS is Debian 12.12
I have tested this locally using the latest versions of both Chrome and Opera browsers.
URL for the correct case: https://openttc.com/t/topic/61
URL for the incorrect case: https://openttc.com/t/topic/58

This is not a bug. Because the default language for all category descriptions (system-created) is En. No matter what you enter, it defaults to En posts. Therefore, translation will not be triggered.

Every post has a detected language done by AI.

If you have a post originally written in “Chinese”, by right, the LLM should detect it to be “zh_CN”. You can view the detected language in the regular composer (not the translation composer) next to the :globe_with_meridians: .

The detected language is important so that the translator does not unnecessarily translate it to the detected language itself, and translates the post to every other language.

I suspect what is happening with https://openttc.com/t/topic/58 is that the detected language is incorrect, can you check?

1 Like

Yes. It was incorrectly detected as en, instead of zh_CN. I checked and found that all system-created category description posts were detected as en. Even those written in Chinese.

New question: Does the FAQ page support multiple languages? Where should the translations be added?

1 Like

I believe the FAQ page uses the typical I18n keys. You can go to your site’s admin page for site texts @ e.g. https://openttc.com/admin/customize/site_texts?q=guidelines_topic.body to replace it.

1 Like

Okay, thank you very much for your help.

I think this is a real problem. I don’t know if this situation is common or due to my configuration error.

It could be time related as well. If the categories were created before the site language was switched, the category topic languages could all be English.

In that case you can go to the categories topics’ first post, open the composer, and toggle them to be Chinese.

Hello. After my attempts.
I created a new category 6 minutes ago: https://openttc.com/t/topic/66
Then I did nothing. Waiting for the translation to take effect.
After that, I got a post whose content is Chinese but was recognized as en.
image
image
When this category was created, my site language was 100% Simplified Chinese.
My AI model uses Openrouter’s Llama3.1 8b.

Interesting, can you run this data explorer query?

-- [params]
-- integer :topic_id = 66

SELECT 
  a.id,
  a.created_at,
  a.response_tokens,
  (REGEXP_MATCH(a.raw_response_payload, '"text": "([^"\\]+)"'))[1] AS llm_detected_locale,
  a.raw_response_payload
FROM ai_api_audit_logs a
JOIN posts p ON p.id = a.post_id AND p.deleted_at IS NULL
LEFT JOIN topics t ON t.id = a.topic_id AND t.deleted_at IS NULL
WHERE t.id = :topic_id
AND p.post_number = 1
AND a.feature_name = 'translation'
AND a.response_tokens < 5

This should tell us what the LLM is actually returning.

If we’re seeing an “en” in the llm_detected_locale column, I suspect your site’s prompts for locale detection may need a change, or you can use a more suitable LLM (maybe qwen?)

Hello. I ultimately did not resolve this issue, but it has had little impact.
The most accurate description of the problem should be: When I create a new category, the default language of the “About this category” post automatically generated by the system is recognized as “en”. Although the text content is indeed Simplified Chinese, when I open the post, it is recognized as English and needs to be manually changed.
I’m not sure if this is related to my app.yml file settings?