コンテンツローカライズ - 手動と自動、Discourse AIと共に

In this topic, we will walk you through the Content Localization features and how to enable them. The features are split into two parts: What is available by default in Discourse; and Discourse AI for automatic translations. For quick access to the relevant sections, use the wiki headings :backhand_index_pointing_right:t2:

Localizing Your Community’s Content

An updated version of Discourse (3.5.0.beta7-dev) gives you access to several localization features available for configuration at:

  • <your-site-url>/admin/site_settings/category/content_localization
New Content Localization in Site Settings 📸

Getting information on your users

Firstly, it is good to get some information on your community. The following data explorer query can give you an idea of how many users may have set their locale in /my/preferences/interface

SELECT locale, count(*) as count
FROM users
WHERE (locale IS NOT null AND locale <> '')
GROUP BY locale
ORDER BY count DESC
Sample results from Data Explorer

Setting locales that your community supports

With the information above, we are now more informed about which locales your community should support.

In <your-site-url>/admin/site_settings/category/content_localization, you can select locales to support.

  • Content localization enabled - turns on the feature that replaces original written user content with localized content. Read on for auto and manual modes of localizing.
  • Content localization supported locales - the list of languages your site supports
  • Content localization anon language switcher - covered just below
List of locales in Site Settings 📸

Enabling the subsequent setting Content localization anon language switcher also allows you to make your community more accessible to non-logged-in users by showing the list of languages you’ve chosen in the list of supported locales:


Language switcher at the top right of the page

Viewing localized content


Localized welcome topic on meta.discourse.org

For viewers of localized content (all site visitors), they may cursor over the indicator next to the post’s date to view the original language of the post. This indicator only shows up if the post is not in their language.

If a user wishes to only see original content, they may use the toggle above the topic timeline to disable localizations for the whole site.

Automatic translations with Discourse AI :sparkles:

Discourse AI are the vitamins essential for the localization feature, and takes away the need to do manual translations.

As an admin, you’d want to head to our new AI features section for Translation.

Discourse AI Features in Admin Settings 📸

Scroll down in /admin/plugins/discourse-ai/ai-features

To cover some important settings and recommendations:

  • AI translation backfill hourly rate - this setting is hidden in the UI and defaults to 0. :warning: Automatic translation will not begin if this value is 0. Assuming the rate is 50, your site will translate 50 posts, 50 topics, and 50 categories per hour, to the locales you have set in Content localization supported locales. Keep this to a low number when starting out.
  • AI translation backfill max age days - defaults to 5. This means topics and posts older than 5 days will not be translated. You may increase this to a large number to translate all topics and posts.
  • AI translation backfill limit to public content - defaults to true. This prevents PMs and content in private categories from being sent to the LLM. When set to false, group PMs, and private categories will be included in translations. PMs between individuals will not be translated.
  • AI translation max post length - defaults to 10000. This is a safeguard and prevents posts above a certain length from being translated.
  • AI translation post raw translator persona (and other personas) - In more formal communities, admins may choose to create their own persona. This allows you to set a prompt that is more fine-tuned to the language or vocabulary you prefer.

You can refer to AI bot - Personas on how to configure suitable personas and fine-tune prompts for each function.

Translation Progress

You may find more information about how automatic translations are progressing in the Translation Progress chart on /admin/plugins/discourse-ai/ai-translations

This chart will show up if

  • all translator personas have a valid LLM
  • discourse ai enabled :check_mark:
  • ai translation enabled :check_mark:
  • content localization supported locales is filled
  • ai translation backfill max age days is more than 0
  • ai translation backfill hourly rate is more than 0

Manual localization

As localization is a core feature in Discourse, we provide the ability for you to fill in and edit localizations manually in the event automatic translations with Discourse AI is not available.

By default, admins and moderators are set up to edit localizations.

Localization allowed groups in Site Settings 📸


Admin Site Setting for Content Localization

Currently, we have post content, topic title, and category name and category description localizations. Tags are not supported yet, but will be in the near future. Subsequent sections below will show you how they work.

Category localization

Localized categories are visible in the following areas, with both category name and description localized:

Places where categories are localized 📸
  1. Homepage, sidebar, and category dropdown
  1. Categories page
  1. A specific category with subcategories

As an admin, you should be able to access category settings as usual, and find the new “Localizations” nav item on the left.

Editing category localizations in Category Settings 📸

Topic and Post localization

From the screenshots above in Category localization, you may have noticed topic titles and excerpts being localized.

There are some pre-requisite settings

  • Ensure your user is in content localization allowed groups
  • Add addTranslation in site setting for post menu. This allows the :globe_with_meridians: to show up in the post menu for users in content localization allowed groups
2 Site Settings 📸


:backhand_index_pointing_down:t2:

Once again, the list of localizable languages is in the Content localization supported locales setting mentioned above.

Editing a localized post

In the event the user might be viewing a localized post, and wants to edit the post, a dialog will appear to ask which version they would prefer to edit:

The appropriate composer will appear after deciding.

Deleting a post’s translation for a certain locale

If you’ve followed instructions above regarding the post menu setting correctly, you should be able to do the following if you’re in the content_localization_allowed_groups:

FAQ

I’ve set things up, but automatic translation is still not working for me
Confirm if you’ve these set up

  • Content localization supported locales has at least one language
  • Content localization enabled is :check_mark:
  • Ai translation enabled is :check_mark:
  • Ai translation max age days is not 0
  • Ai translation backfill hourly rate is more than 12. This is a hidden site setting which requires console access.
  • You must have a working LLM set for each translation persona

If all else fails, you can enable SiteSetting.ai_translation_verbose_logs.

Is every post getting translated?
If AI translation backfill limit to public content is :check_mark: , all posts in public categories except for Bot (user id < 0) posts will be translated.

Are the automatic translations saved, or is it being sent to the LLM each time someone views a topic?
The translations are saved, each post is only sent once per language and the translations are reused.

If my forum supports English and Japanese (via Content localization supported locales), and someone writes in Spanish, will their post be translated?
Yes. All topics and posts will be translated to English and Japanese, regardless of the written language.

If the original post is edited, is it re-translated?
Yes – with a maximum of 2 times per day. When a post is edited, it gets sent to re-translation 5 minutes later (or the SiteSetting.editing_grace_period) to account for ninja edits.

Will translations be deleted if I change the Persona or LLM?
No, translations will typically persist across settings changes unless explicitly deleted using the post menu item or the translation composer.


「いいね!」 21

既存のカテゴリに対して一括でこれを行うための推奨事項はありますか?最悪の場合、API経由で可能でしょうか?

「いいね!」 2

うーん、良い質問ですね。カテゴリ更新エンドポイントのAPIドキュメントが更新されるようにします。:memo:

「いいね!」 4

言語ごとのモデレーターのサポートはありますか?メタについて考えています。そこでは特定の言語の投稿をチェックし、手動で更新するボランティアをするかもしれません。特に、人間的なタッチを歓迎する可能性のあるドキュメントについてです。しかし、あなたは「モデレーターのみが実行できます」と言っていますが、私はおそらくモデレーターにはなれません。

「いいね!」 2

うーん、良い提案ですね。それは可能だと思いますが、どのように設定するか詳細を考える必要があります。

「いいね!」 2

アクセスするにはどうすればよいですか?コマンドを提供していただけますか?

Sidekiq にリンクされたジョブはありますか?手動でトリガーすることは可能ですか?

「いいね!」 1
「いいね!」 2

Moinさんの上記の投稿に付け加えると、コンソールにアクセスしたら、SiteSetting. ai_translation_backfill_hourly_rate だけで済みます。ジョブは5分ごとに実行され、それに応じてレート制限がかかります。

「いいね!」 2

ドキュメントでローカライズが利用可能になったのですね。@natさん、ありがとうございます!

「いいね!」 3

素晴らしいですね、チームの皆さん、おめでとうございます!今すぐテストして、私の考えや全体的な経験を共有します。

Esperantoがリストにありません。これは「単純に」追加できますか、それともまずdiscourse-languagesに組み込む必要がありますか?

すごい、よく気が付きましたね。まさに報告しようとしていたところです。:laughing:

はい、その通りです。コントロール(ボタン、ラベルなど)が Crowdin (Translations - Discourse Meta を参照) を介して適切かつ十分に(70% あれば非常に良い)翻訳された、完全なローカライズされたエクスペリエンスを提供したいと考えており、それによってその言語のサポートを提供できます。

「いいね!」 1

ドキュメントカテゴリでコンテンツのローカライズは機能しますか?インデックストピックをローカライズしても、サイドバーのコンテンツが翻訳されていないようです。

また、奇妙な動作にも気づきました。ローカライズされたトピックを元の言語で表示し、更新すると、ローカライズされたバージョンに切り替わります。元のバージョンに手動で再度切り替える必要があります。

「いいね!」 2

素晴らしい発見ですね。まだ動作していませんが、@nat が追跡してくれるはずです!

これがサイドバーのドキュメントリンクのための、より良い抽象化/データモデルを考案するきっかけになるかどうか、気になります。

「いいね!」 1

はい、その通りです。Discourseには明示的な翻訳が必要な場所がたくさんあるため、見つけ次第記録しています。最近では、トピックタイトルの通知もローカライズしました。これは私が作成した機能トピックの例です - https://meta.discourse.org/t/show-translated-user-bios/378908。

新しいトピックを作成し、@メンションしますので、サイドバーのすべての項目を確実に網羅できるようにします。

編集:@tvavrda はここでカバーされています - https://meta.discourse.org/t/translate-sidebar-documentation-links/379540。確認して、意味が通じるか見てください。

「再度切り替える」とはどういう意味ですか?

次回発生した際には、動画(アドレスバーを含めて)を共有していただけますか? :folded_hands:t2: このケースの内容が公開に適さない場合は、お気軽にDMでご連絡ください。また、ログインしていましたか? 技術的には、これらはクッキーによって追跡されるため、私にとっては少し不可解です。

「いいね!」 1

ビデオを送りました。

もう一つの観察事項ですが、翻訳されたコンテンツの差分を確認することはできませんよね?もしコンテンツが更新された場合、それは役立つかもしれません。それほど重要ではありませんが、理にかなっていると思います。

さらに、トピックの下にあるバックリンクには、ローカライズされたトピック名が表示されません。

そして質問ですが、カテゴリ設定でカテゴリの説明をローカライズする意味は何でしょうか?カテゴリの説明は、「About」トピックのローカライズされたバージョンから取得されるべきではないでしょうか?ローカライズされたバージョンはMarkdownをサポートしていないため、リンクを使用できませんが、私はリンクを使用したいのです。

「いいね!」 1

古い GitHub - discourse/discourse-docs-sidebar コンポーネントは、実際にはローカライゼーションを尊重しています :slight_smile: 一時的にそちらに切り替えました。

はい、これも現在サポートされておらず、かなりの労力が必要です。

投稿の編集インジケーターに似た、特別な色のインジケーターがあり、投稿バージョンが変更されたため翻訳が古い可能性がある場合に表示されます。

「いいね!」 1

ピン留めされたトピックの概要にも翻訳されていないコンテンツが表示されます。トピックリストは翻訳された言語で表示されますが、ピン留めされたトピックの概要には元の言語が表示されます。

「いいね!」 1

手動で翻訳を行ったり修正したりすることはできますが、翻訳のビルドを手動でトリガーすることはできますか?オンデマンドジョブのようなものです。

考えているのは、1年前のトピックの翻訳を許可したということです。しかし、その1年は現在の日付からカウントされる場合、その制限はすでに翻訳されたコンテンツに向かって常に移動します。しかし、最大の需要は、より速く、かなり遅い一括処理なしで到達したい古い価値のあるコンテンツです。

翻訳を有効にした後のコストに関する情報をお持ちの方はいらっしゃいますか?当社のサイトはしばらく前から存在しており、可能であればサイト全体を翻訳したいと考えていますが、コストは間違いなく懸念事項です。そのため、経験から、例えば1000件の投稿で1ドルのような、おおよそのコストの目安があれば、概算コストを把握するのに大いに役立ちます。

コンテンツのローカライズは一度行われ、どこかに保存されるのでしょうか?つまり、オンデマンドではないのでしょうか?もしそうなら、私のデスクトップでOllamaとLlama 3やDeepseek 3のようなオープンソースLLMを起動して、完了するまでジョブを実行させることを妨げるものはありますか?

編集:初期翻訳コストを下げることは可能かもしれませんが、新しい投稿に対しては、ローカルLLMを永続的に実行し続けると決断しない限り、機能しないでしょう。