Localización de contenido - Manual y automática con 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 Me gusta

¿Hay alguna recomendación para hacer esto en bloque para las categorías existentes? En el peor de los casos, ¿quizás a través de la API?

2 Me gusta

Hmm, gran pregunta. Me aseguraré de que la documentación de la API se actualice para el punto final de actualización de categorías. :memo:

4 Me gusta

¿Habrá soporte para moderadores por idioma? Estoy pensando en meta, donde podría ser voluntario para revisar las publicaciones en un idioma específico y actualizarlas manualmente. Especialmente la documentación, que puede beneficiarse de algunos toques humanos. Pero dices que solo los moderadores pueden hacerlo, lo cual probablemente nunca seré.

2 Me gusta

Hmm buena sugerencia. Creo que eso se puede hacer pero tendremos que pensar en los detalles de cómo se puede configurar.

2 Me gusta

¿Cómo accedo a ella? ¿Podría proporcionar un comando, por favor?

¿Sidekiq tiene algún trabajo vinculado? ¿Es posible activarlo manualmente?

1 me gusta
2 Me gusta

Para añadir a la publicación de Moin de arriba, es solo SiteSetting. ai_translation_backfill_hourly_rate una vez que acceda a la consola. El trabajo se ejecuta cada cinco minutos y limita la tasa en consecuencia.

2 Me gusta

Veo que la localización ya está disponible en la documentación. ¡Gracias @nat!

3 Me gusta

¡Eso es maravilloso, felicitaciones al equipo! Lo estoy probando ahora mismo y compartiré mis pensamientos y mi experiencia general.

Echamos de menos el esperanto en la lista; ¿se puede añadir ‘simplemente’ o primero debe integrarse en discourse-languages?

Vaya, estás al tanto. Estaba a punto de informar aquí. :laughing:

Sí, algo así. Queremos una experiencia de localización completa donde los controles (botones, etiquetas, etc.) se traduzcan correctamente y de forma suficiente (el 70% estaría muy bien) a través de Crowdin (ver Translations - Discourse Meta), y con eso podremos ofrecer soporte al idioma.

1 me gusta

¿Funciona la localización de contenido con las Categorías de Documentación? Me parece que el contenido de la barra lateral no se está traduciendo aunque localice el tema del índice.

También noté un comportamiento extraño. Cuando veo un tema localizado en el idioma original y actualizo, cambia a la versión localizada. Tengo que volver a cambiar manualmente a la versión original.

2 Me gusta

Oh, qué gran acierto, sí que no está funcionando todavía, ¡pero es algo que @nat seguirá!

Me pregunto si esto es un catalizador para crear una mejor abstracción / modelo de datos para los enlaces de documentos de la barra lateral.

1 me gusta

Sí, es correcto: hay muchos lugares en Discourse que necesitarán traducción explícita, así que los estoy registrando a medida que surgen. Más recientemente, también localizamos las notificaciones para los títulos de los temas. Este es un ejemplo de un tema de características que creé: Show translated user bios.

Crearé un nuevo tema y te mencionaré para asegurarnos de cubrir todas las bases en la barra lateral.

EDITAR: @tvavrda cubierto aquí: Translate sidebar documentation links. Por favor, échale un vistazo y mira si tiene sentido.

¿A qué te refieres con “volver a cambiar”?

¿Te importaría compartir una grabación de video (incluye la barra de direcciones) la próxima vez que suceda? :folded_hands:t2: Siéntete libre de enviarme un mensaje privado para este caso si el contenido no es adecuado en público. Además, ¿estabas conectado? Técnicamente, estas cosas se rastrean mediante cookies, así que es un poco desconcertante para mí.

1 me gusta

Te envié un video.

Otra observación: no puedo ver las diferencias del contenido traducido, ¿verdad? Eso podría ser útil si hay actualizaciones. No es súper importante, pero tendría sentido, supongo.

Y otra más: los enlaces entrantes debajo del tema no muestran un nombre de tema localizado.

Y una pregunta: ¿cuál es el propósito de localizar las descripciones de las categorías en la configuración de la categoría? La descripción de la categoría debería provenir de la versión localizada del tema “Acerca de”, ¿no? La versión localizada no admite markdown, por lo que no puedo usar un enlace, lo cual me gustaría.

1 me gusta

Bueno… el componente antiguo GitHub - discourse/discourse-docs-sidebar en realidad respeta la localización :slight_smile: Temporalmente cambié a ese.

Sí, esto actualmente tampoco es compatible y sería una tarea bastante ardua.

Tenemos un pequeño indicador de color especial (similar al indicador de ediciones de publicaciones al lado) cuando una traducción puede estar desactualizada, ya que la versión de la publicación ha cambiado.

1 me gusta

También veo contenido sin traducir en los resúmenes de los temas fijados. Así que veo una lista de temas en el idioma traducido, pero el resumen del tema fijado muestra el original.

1 me gusta

Podemos hacer o arreglar traducciones manualmente, pero ¿podemos activar manualmente la compilación de traducciones? Algo así como un trabajo bajo demanda.

Lo que estoy pensando es que he permitido la traducción de temas de hace un año. Pero si ese año se cuenta desde la fecha actual, ese límite se moverá todo el tiempo hacia el contenido ya traducido. Pero la mayor demanda es contenido valioso más antiguo al que me gustaría llegar rápido y sin acciones masivas bastante lentas.

Tengo curiosidad, ¿alguien tiene cifras de costos después de activar las traducciones? Nuestro sitio ha existido por un tiempo y, aunque me gustaría traducir todo el sitio si es posible, el costo es definitivamente una preocupación. Así que si alguien tiene una idea aproximada del costo según su experiencia, por ejemplo, 1000 publicaciones resultan en un costo de $1, eso ayudaría enormemente a tener una idea del costo aproximado.

¿La localización del contenido se hace una vez y luego se almacena en algún lugar, es decir, no bajo demanda? Si es así, ¿hay algo que me impida iniciar Ollama y algún LLM de código abierto en mi escritorio como Llama 3 o Deepseek 3 y simplemente dejar que el trabajo se ejecute hasta que termine?

Editar: Supongo que podría funcionar para reducir el costo inicial de traducción, pero no funcionará para publicaciones más nuevas a menos que uno decida mantener el LLM local funcionando perpetuamente.