Content-Lokalisierung – Manuell und automatisch mit 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 „Gefällt mir“

Gibt es Empfehlungen, dies für bestehende Kategorien in großen Mengen zu tun? Im schlimmsten Fall, vielleicht über die API?

2 „Gefällt mir“

Hmm, gute Frage. Ich werde dafür sorgen, dass die API-Dokumentation für den Endpunkt zur Kategorieaktualisierung aktualisiert wird. :memo:

4 „Gefällt mir“

Wird es Unterstützung für Moderatoren pro Sprache geben? Ich denke an Meta – wo ich mich vielleicht freiwillig für die Überprüfung von Beiträgen in einer bestimmten Sprache und deren manuelle Aktualisierung melden würde. Insbesondere Dokumentationen, die einige menschliche Berührungen vertragen könnten. Aber Sie sagen, nur Moderatoren können es tun, was ich wahrscheinlich nie sein werde.

2 „Gefällt mir“

Gute Idee. Ich denke, das kann gemacht werden, aber wir müssen über die Details nachdenken, wie es eingerichtet werden kann.

2 „Gefällt mir“

Wie greife ich darauf zu? Könnten Sie bitte einen Befehl angeben?

Hat Sidekiq einen Job damit verknüpft? Ist es möglich, ihn manuell auszulösen?

1 „Gefällt mir“
2 „Gefällt mir“

Um Moin’s Beitrag oben zu ergänzen: Es ist einfach SiteSetting. ai_translation_backfill_hourly_rate, sobald Sie die Konsole erreicht haben. Der Job läuft alle fünf Minuten und die Ratenbegrenzung erfolgt entsprechend.

2 „Gefällt mir“

Ich sehe, dass die Lokalisierung jetzt in der Dokumentation verfügbar ist. Danke, @nat!

3 „Gefällt mir“

Das ist wunderbar, Lob an das Team! Ich teste es gerade und werde meine Gedanken und meine Gesamterfahrung teilen.

Esperanto fehlt auf der Liste; kann es ‘einfach’ hinzugefügt werden, oder muss es zuerst in discourse-languages integriert werden?

Wow, du bist ja auf Zack – ich wollte das gerade melden. :laughing:

Ja, irgendwie schon. Wir wollen ein vollständiges lokalisiertes Erlebnis, bei dem die Steuerelemente (Schaltflächen, Beschriftungen usw.) ordnungsgemäß und ausreichend (70 % wären wirklich gut) über Crowdin übersetzt werden (siehe Translations - Discourse Meta), und damit können wir die Unterstützung für die Sprache anbieten.

1 „Gefällt mir“

Funktioniert die Inhaltslokalisierung mit Dokumentationskategorien? Mir scheint, dass der Seitenleisteninhalt nicht übersetzt wird, obwohl ich das Index-Thema lokalisiere.

Außerdem ist mir ein seltsames Verhalten aufgefallen. Wenn ich ein lokalisiertes Thema in der Originalsprache sehe und aktualisiere, wechselt es zur lokalisierten Version. Ich muss manuell wieder zur Originalversion wechseln.

2 „Gefällt mir“

Oh, fantastischer Fang, ja, es funktioniert noch nicht, aber @nat wird sich darum kümmern!

Ich frage mich, ob dies ein Katalysator für die Entwicklung einer besseren Abstraktion / eines besseren Datenmodells für die Sidebar-Dokumentationslinks ist.

1 „Gefällt mir“

Ja, das stimmt – es gibt viele Stellen in Discourse, die eine explizite Übersetzung benötigen, daher protokolliere ich sie nach und nach. Zuletzt haben wir auch Benachrichtigungen für Themenüberschriften lokalisiert. Dies ist ein Beispiel für ein Feature-Thema, das ich erstellt habe - Show translated user bios.

Ich werde ein neues Thema erstellen und dich @erwähnen, damit wir sicherstellen, dass wir alle Bereiche im Sidebar abdecken.

EDIT: @tvavrda wurde hier behandelt - Translate sidebar documentation links. Bitte schau es dir an und sieh, ob es Sinn ergibt.

Was meinst du mit „wieder wechseln“?

Könntest du bitte das nächste Mal, wenn es passiert, eine Videoaufnahme (einschließlich der Adressleiste) teilen? :folded_hands:t2: Fühle dich frei, mir in diesem Fall eine Direktnachricht zu senden, wenn der Inhalt nicht für die Öffentlichkeit geeignet ist. Warst du auch eingeloggt? Technisch gesehen werden diese Dinge über Cookies verfolgt, daher ist es für mich etwas rätselhaft.

1 „Gefällt mir“

Ich habe dir ein Video geschickt.

Eine weitere Beobachtung – ich kann die Unterschiede der übersetzten Inhalte nicht sehen, oder? Das könnte nützlich sein, wenn es Aktualisierungen dazu gibt. Nicht sehr wichtig, aber es wäre sinnvoll, denke ich.

Und noch eine – die Backlinks unter dem Thema zeigen keinen lokalisierten Themennamen an.

Und eine Frage: Was bringt es, Kategoriebeschreibungen in den Kategorieeinstellungen zu lokalisieren? Die Kategoriebeschreibung sollte von der lokalisierten Version des „Über uns“-Themas stammen, oder? Die lokalisierte Version unterstützt kein Markdown, daher kann ich keinen Link verwenden, was ich gerne tun würde.

1 „Gefällt mir“

Nun… die alte GitHub - discourse/discourse-docs-sidebar Komponente respektiert tatsächlich die Lokalisierung :slight_smile: Ich bin vorübergehend zu dieser gewechselt.

Ja, das wird derzeit auch nicht unterstützt und wäre ein ziemlicher Aufwand.

Wir haben eine kleine speziell farbige Anzeige (ähnlich der Anzeige für Beitragsbearbeitungen daneben), wenn eine Übersetzung veraltet sein könnte, da sich die Beitragsversion geändert hat.

1 „Gefällt mir“

Ich sehe auch einen unübersetzten Inhalt in den Zusammenfassungen angehefteter Themen. Ich sehe also eine Themenliste in der übersetzten Sprache, aber die Zusammenfassung des angehefteten Themas zeigt das Original.

1 „Gefällt mir“

Wir können Übersetzungen manuell durchführen oder korrigieren, aber können wir den Aufbau von Übersetzungen manuell auslösen? So eine Art On-Demand-Job.

Was ich mir vorstelle, ist, dass ich Übersetzungen für ein Jahr alte Themen zugelassen habe. Aber wenn dieses Jahr ab dem aktuellen Datum gezählt wird, wird sich diese Grenze ständig in Richtung bereits übersetzter Inhalte verschieben. Aber die größte Nachfrage besteht nach älteren wertvollen Inhalten, die ich schnell und ohne ziemlich langsame Massenaktionen erreichen möchte.

Ich bin neugierig, hat jemand Kostenschätzungen, nachdem die Übersetzungen aktiviert wurden? Unsere Seite existiert schon eine Weile, und obwohl ich die gesamte Seite übersetzen möchte, wenn möglich, sind die Kosten definitiv ein Anliegen. Wenn also jemand eine grobe Vorstellung von den Kosten aus seiner Erfahrung hat, z. B. 1000 Beiträge kosten 1 $, würde das enorm helfen, um eine ungefähre Kostenschätzung zu erhalten.

Wird die Inhaltlokalisierung einmal durchgeführt und dann irgendwo gespeichert, d. h. nicht nach Bedarf? Wenn ja, hindert mich etwas daran, Ollama und ein Open-Source-LLM auf meinem Desktop wie Llama 3 oder Deepseek 3 zu starten und den Job einfach laufen zu lassen, bis er fertig ist?

Bearbeitung: Ich schätze, es könnte funktionieren, um die anfänglichen Übersetzungskosten zu senken, aber es wird nicht für neuere Beiträge funktionieren, es sei denn, man beschließt, das lokale LLM dauerhaft laufen zu lassen.