I finally figured how to do multilingual translations on FluentCommunity!! 🥹
My community is multilingual so I desperately needed multilingual option. I tried Translatepress, Gtranslate, and nothing was compatible…
HTML of google translator did the work but showed google iframe logo on the top so it was ugly.. and it was impossible to hide it.
I literally can’t believe I figured it out because I’ve searched for it like crazy and was also told by support it’s not possible.
So if anyone else needs this - you just need to install Gtranslate plugin and then embed THIS HTML GTranslate widget: https://gtranslate.io/website-translator-widget
Without this html widget it won’t work.
Then you can stylize as you want (I put it into header). Ofcourse, translations are not perfect, but for my case it’s better than nothing (and ofcourse you can edit words on paid plans).
Hopefully this will help anyone who had been in the same struggle as me 😄
How did you put it in the Fluentcommunity header?
Natascha Vantuykom I used globe widget from GTranslate and put it into header with code snippets (I think you can also use fluentsnippets) 😄
Tjaša Peterle would you like to share the codesnippets?
Tjaša Peterle how does the snippet look like for this case?
Natascha Vantuykom sorry for late answer! My code snippet is extremly long as it is very customised and has other featured in header besides translation (for example BetterMessages, hiding of dark/light theme icon etc…)
But it is just regular style of “header” Fluentcommunity snippet (I will copy-paste it here). You can message me if you will have troubles! :)
Sophia S my code snippet is extremly long but just refer to this link: https://github.com/WPManageNinja/fluent-community-docs/blob/master/code-snippets.md
Tjaša Peterle that's great. Hope. It doesn't affect the performance of your site
Tjaša Peterle I need a little more, please. Where do you embed the widget?
Sophia S nope, it is super fast even with 1000+ active users :)
J V in the header (check code below)
This helps alot Tjaša Peterle so does it work fine with community engagment? i.e when people are posting and commenting in various languages?
Morgan McArthur That is what I would like to know as well. I don't need to translate the site itself so much, but it would be nice to have translation for post and comments inside of the community. Since I have some customizations with the help of Loco Translate I would also like to keep those and not have the translation taking me back to default.
J V let's see if Tjaša Peterle responds, I will be looking more into this and possibly do some testing also.
Morgan McArthur yes it translates everything :)
J V yeah it just translates everything automatically :)
add_action('fluent_community/before_header_menu_items', 'add_translation_globe');
function add_translation_globe() {
?>
window.gtranslateSettings = {
default_language: "en",
detect_browser_language: true,
languages: ["en", "fi", "sv", "de", "fr", "sl", "pl", "cs"],
globe_color: "#b0b0b0",
wrapper_selector: ".gtranslate_wrapper"
};
/ Optional styling for popup or globe /
// Optional JS for translation notice popup
\<?php
}
I copy-pasted my code to GPT and asked to remove other stuff that I have customised for my community and leave out only translation widget.. I didn’t test it but you can use the code above as a template :)
Tjaša Peterle Thank you so much 😍
J V you’re welcome 😄
Thanks Tjaša Peterle but does it translate for multiple languages in a community chat for other various members of the same post/comment? ... meaning if a person types something in Spanish and I respond in english the Spanish person will see my response in Spanish as it translates for them. However what about other members seeing the spanish comment but their language is Italian for instance.
Morgan McArthur yes this is possible if you set that it auto detects the lanugage :)
For example in code above it is set that default language is english but you can just change it that it detects automatically and translates to desired language
And yes it translates everything including chats, comments, posts…
However I use BetterMessages instead of FluentChat so can’t guarantee that it works all the same :)
Tjaša Peterle ok thanks so then for community posts and comments it auto translates everything no matter the language the post or comment is in cool.
The code you provided above is this to get the globe appearing in the FluentCommunity header next to profile?
Morgan McArthur yeah it should be something like this :)
Tjaša Peterle you're a star! thank you!
A few years back, I used and got frustrated with Gtranslate. The major issue I was facing was that all custom translations were lost every time a page or post was updated or changed in any way. This was happening even with their $19.99 a month plan. This really sucked and I just got rid of it. Now, if you just have a simple site or don't care for custom translations, then this might be just fine for you. Aside from that, the plugin works pretty much fine.
Eli Linares well this is the only plugin that made my FluentCommunity multilingual. If you know any other way I will be happy to hear about it. :)
Eli Linares That is my worry. For now I cannot make myself try, however I have bookmarked this post for when I am ready for that. On my staging site that is. ;)
I hear GTranslate is not the greatest of plugins, TranslatePress is much better, however TranslatePress does'nt work with GTranslate. It's the best Tjaša Peterle found to work with FluentCommunity. It does work and is a bit jenky, but nice to have a globe men icon with languages to choose from for basic translation like a browser would do.
Morgan McArthur exactly. I tried everything to achieve multilingual community and this was the only way
I noticed that TranslatePress worked once, but then it stopped working.
I tried using it to translate my course content — it worked one day, but then the translation feature stopped working again.
The good thing about TranslatePress is that in the free version, you can manually enter the correct translation.
On the other hand, GTranslate offers automatic translation, but it’s not very accurate — especially when you have a multilingual website with both left-to-right (LTR) and right-to-left (RTL) languages.
I think GTranslate doesn’t fully support RTL layouts.
Which subscription did you choose for Gtranslate?
Tjaša Peterle I don't see the code anymore in the markdown. And the code snippet above doesn't appear to be working.