1 forum for multiple languages or 1 forum per language?

I have some forums setup in English and wanted to get them setup in multiple languages as well. For each language I’d like the user to see the registration details and their settings to be in their language rather than just English.

My question is should I create a separate forum for each language which requires users to register for 2 or more if they wanted to post on 2 languages or is it possible to have everything setup in 1 forum? My guess is it would be best practice to create separate forums where if users needed English and another language, 2 signups are required.

Either way is possible, one thing we do want to do and I think @simon already worked some on, is auto select a UI client language based on a category. So you could have “Russian” as a category and when you visit there, your client UI would automatically switch to the Russian locale.

5 Likes

Do you have some forum examples that have multiple languages available? What I’d like to do if using 1 forum for all the languages is to make sure that users aren’t seeing the other language threads and the language they are in so they see the language categories and the recent language threads.

Would you have the post talking about this subject? I was looking for it but could not find it :frowning:

Possibly this post. I’ve moved it into the broken-plugin category. The plugin hasn’t been updated in a while. The way it is reloading the forum when the locale changes could be improved. I can do some work on it if there is interest in using it.

Localized categories plugin

2 Likes

This seems interesting for me… but it depends on how much work it would represent to update it and maintain it. If this is a lot of work, then its probably not worth it.

The code that sets the locale based on the category slug is very basic and would be easy to maintain. The difficulty is that for the category locale to take effect, the site needs to be reloaded when the locale changes. That was working the last time I tried it.

There is also a problem with with the anonymous cache caching the locale for sites that are using a CDN. I ran the plugin for a while using a CDN and a forked version of Discourse. It worked, but it’s not a change to Discourse that I would want to be responsible for.

1 Like

so is a plugin an alternative? Otherwise I think I’m looking at having multiple languages for websites with individual forums for those sites where the users and databases are not connected. Ideally I’d like to have it one signup will control everything so users that participate in more than one language, don’t need to do multiple signups.

If you are not using a CDN for assets, selecting the site setting ‘set locale from accept language header’ will make it so that most users are able to go through the registration process in their own language. This will also set their default interface language to the language that they have signed up with.

You could then create categories/sub-categories for each language and promote the idea that discussions in each language category should be in the correct language. This would give all users access to all language categories, but also add some organization to your site.

The only place I see this not working is if there are left-to-right and right-to-left languages on the same site. To allow users to access both LTR and RTL language categories, you would need something like the localized-categories-plugin, or the ability for text-direction to be set from the text entered into the editor would need to be added to Discourse: Set direction of text depending on text itself (I think the second solution would be preferrable, as it wouldn’t require reloading the entire site when all that is needed is the change of one line of css.)

A couple of changes to Discourse could make this work better:

  • make it possible to set the locale from the accept-language header when a CDN is being used.

  • add a category/sub-categories page that would have a similar layout to the current categories page. For example, at the URL myforum.com/c/de/sub-categories there would be a page similar to what is at myforum.com/categories, but it would list the sub-categories that were found in the German section of the site.

Edit: for this type of approach to work, you will also need to select the site setting ‘allow user locale.’ This setting allows users to select their own interface language, instead of forcing them to use the site’s default locale.

1 Like

The problem with these kinds of approaches is that they can destroy anonymous caching and explode the CDN cache times the number of languages. So caution is warranted here.

Yes, the localized-categories plugin has the same issue with anonymous caching.

It’s possible to extract the desired locale from accept-language header before adding it to the cache_key. That way the cache isn’t be broken for every possible accept-language header. It’s also unlikely that any site would need more than 2 or 3 languages. If a forum’s supported locales were set as a global setting, those suupported locales could be compared agaist the locale extracted from the accept-language header. The cache_key would only need to be updated if the locale extracted from the accept-language header matched one of the site’s supported locales.

This might still be too inefficient, but not as bad as busting the cache for every possible locale.

Thanks, I will give this a try and test it out. So far not doing anything for CDN on the forum, maybe when things grow will consider this unless it’s highly recommended for now. Otherwise I see how there can be clashes.

Hi @simon,

Is there now a way for the accept-language header to be utilized in a CDN? Even being able to select a handful of languages would help expand the utilization of our Discourse community on a global basis.

3 Likes