منشور متعدد اللغات في ديسكورد

discourse-multilingual-post

A Discourse plugin that allows multiple localized versions of post content.

This plugin is a proof-of-concept : without the possibility to localize topic titles, it is not very useful.

How to use

In a post, use [lang=xx] blocks:

[lang=en]
Hello World!
[/lang]
[lang=fr]
Bonjour monde !
[/lang]
[lang=de]
Hallo Welt !
[/lang]

Result:

Hallo Welt !

Country codes must be 2-letter long (regions are not supported).

How it works

When rendering a post, the plugin seeks one [lang=xx] block to display. It will stop seeking once it has found:

  1. the block set for the language of the user (as selected by Discourse)
  2. the block set for the default language of the Discourse instance
  3. the first block

Repository

https://github.com/sylque/discourse-multilingual-post

13 إعجابًا

Discourse team, any idea how I could localize topic titles?

What I would like to do is this:

  • Define a language order, for example “en,fr,de”
  • Allow users to write topic titles like this: Hello World#Bonjour monde#Hallo Welt
  • When Discourse displays a topic title, modify it to only keep the right language

However, I found no client-side hook to modify the title. Any idea?

6 إعجابات

Did you consider handling titles in Rails? Default language is the existing one, while additional titles are custom topic fields. Then you change serializers to send the selected language title in the payload.

8 إعجابات

Great work!

I would second this. I think server-side is the way to go for titles.

I’m actually in the process of building a multilingual plugin (almost finished) that allows for translations of:

  1. Tags
  2. Category names
  3. Caegory descriptions

As well as an admin panel to administer languages and locales and a bunch of other things like user specific language content filters.

There could be scope to combine forces here.

14 إعجابًا

مرحبًا! أنا أحب هذا الملحق وبساطته، وأعتقد أنه سيكون أكثر فائدة إذا كان يدعم تزيين صفحات discourse (الأسئلة الشائعة/القواعد، شروط الخدمة، سياسة الخصوصية) نظرًا لأن العناوين تُترجم على أي حال. لقد حاولت إنشاء نسخة منه وتطويرها بنفسي، ولكن بصراحة أنا مبتدئ تمامًا. رغم أنني أشعر بأنه يحتاج إلى إعادة كتابة حول decorateWidget() بدلاً من decorateCooked().

إعجاب واحد (1)

إضافة زخرفة لصفحة ثابتة في Discourse (مثل الأسئلة الشائعة/المبادئ التوجيهية، وشروط الخدمة، وسياسة الخصوصية) ستكون ميزة رائعة. ومع ذلك، لست متأكدًا مما إذا كانت decorateWidget تحتوي على خطاف للصفحات الثابتة. هل لدى أحد أي تلميح حول هذا؟