FYI, Full translation of Discourse including posts is possible

For anyone interested in multilingual Discourse sites, I wanted to share info about a product that I recently was able to integrate with my hosted site. I’m not associated with this company in any way other than as a customer and I get no compensation. I just am impressed with this tech and want to share it because translation is so hard and this makes it so easy!

The product is called Linguise. You can see how it gets set up to work with Discourse (or similar tech) in this video.

Basically, you create an account (free for 30 days) and it guides you through setting up some DNS CNAMEs for the main domain of your site that include a 2-letter language prefix. For example, fr.mysite.com, es.mysite.com–one for each language you want to make available.

They then give you a customized element that you need to include on the Discourse site. The easiest way to do this is to create a new theme component, then place their script command in the <Head> section.

That is all it takes. A language switcher now appears on your site (you can adjust its placement and other characteristics easily).

Click on that switcher and choose another language and the page will refresh. You’ll see most screen elements get blurred for a second or two, then the entire page will be machine-translated.

That includes menus, headings, category names, post names, post content, etc. Even the admin and settings screens get translated.

It is amazing. You have 85 languages to choose from, and pricing is based on how many words get translated-it doesn’t care which languages are used. It starts around $15 per month and maxes out at $45 per month for unlimited usage.

This tech also works on nearly any site. They directly support Wordpress, Joomla, Squarespace, Wix, Drupal and many E-commerce sites, etc. But the way this works for Discourse is a kind of general mechanism that can translate any site–even ones you don’t have source code or back-end access to, so long as you have a way to include that one tag.

6 Likes

Would you share your theme component?

Is it possible to customize translations (category names, topic titles …)?

3 Likes

Video guide for Linguise isn’t enough for enabling me to translate my discourse site.

At the very first step, where we need to choose our Platform, ‘Discourse’ is not an option there, and the youtube video is silent as to what to choose from that list if we’re on discourse site (and we can’t ahead move unless we make a correct choice there).

Hi Bathinda. You choose “Other cloud-hosted CMS”.

2 Likes

Hi Thomas,

You can easily create your own, empty Theme Component by going to Admin/Themes/Components.

Click on Install, and in the dialog that appears, click Create New:

On the next dialog, give it a name:

That creates an empty component. Now all you need to do is click Edit CSS/HTML:

Go to the tab called Head. There you will paste in the custome script tag that Linguise gives you when you set things up on their website:

In my image, I included some comments, but you would normally just get a blank list into which you would paste your custom Linguise URL.

Note that, working with Linguise tech support, we found that the script tag needed to be modified slightly because sometimes the page required a manual refresh when changing languages.

If you change the beginning of the tag so it starts <script defer src=… that fixes the manual refresh problem.

As a side note, these simple Custom Components can be used as a a safe and elegant way to make any overrides to the theme you are using and to affect many screen elements.

For example, on my site I have disabled a number of screen elements that I felt would just confuse my user population. To do that, on the CSS tab I added some CSS selectors with the property display: none.

For example, this suppresses the Add Section button on the sidebar:

.sidebar-wrapper .sidebar-footer-wrapper .btn-flat.add-section {
    display: none;
}

The tricky part is figuring out the CSS selectors (i.e the part before the open bracket), but if you use the developer tools on your web browser, you can generally find the screen items and copy their selectors.

Good luck!

3 Likes

This is very good and detailed explanation.
Thanks for that.

1 Like

I wanted to follow up with some additional details from our experience getting Linguise working well with Discourse.

First, on our site we use the Discourse SAML plugin for authenticating users against a different user store. We found that there was a cookie issue in that particular case.

Fortunately the folks at Communiteq (https://www.communiteq.com/), who are an excellent hosting company for Discourse, were able to analyze the issue and create a tiny fix in the form of a plugin to resolve it. But for most folks it won’t be needed.

There is one limitation you should be aware of; Linguise does no translation when it is running in whatever its default language is, in our case, English.

Normally this is not an issue but there is one case where it is—Posts authored in another language, say Spanish, appear in Spanish when Linguise is set to English. In any other language, they would get translated, but not in the default language.

Linguise may improve this going forward, but there is no commitment.

The workaround for this is to also make use of the Discourse Translator plugin. You need to set up access to one of the translation companies (Google, Yandex, Microsoft, etc.) API, then configure those credentials in the plugin.

Once you do that, if you are in English and reading a post created by someone in Spanish, you will see a small globe icon

Clicking that causes a translation to appear underneath the original.

Between the two, it covers all cases, although not as elegantly as I would have wished.

We use a Google Cloud account that gives the first 500,000 words each month for free, and we rarely exceed that limit. I think other vendors have similar deals.

I hope this is helpful for someone.

3 Likes