Translate for Flarum helps translate all your discussions without you having to do a thing. Using AI all comments on your community can be auto translated based on the users' language, it's as simple as clicking a button.

All monthly/yearly subscription plans come with a 7 day free trial, so you can determine if this extension is right for you or not.

Technical support and updates are both included in your subscription.

Features

  • Post language detection - a handy label is displayed when the post is viewed if the viewer's locale differs to that of the post. User preference option to always show the label, if required.
  • Post language detection is independent of any installed Forum language packs.
  • On demand post translation - displayed directly under the original content. Translations are cached in the database to reduce the number of translation requests to the provider, saving money (if your provider charges per translation request), and provide a speed increase.
  • Formatting is preserved as far as possible between the original and translated content by running translated content back through the same post renderer as the original.
  • Users may translate from any driver supported language to any enabled forum language (subject to permission). Just one language pack installed? No problem! This extension will simply translate any 'foreign' posts to your single language seamlessly.
  • Automatic updates to cached translations after a post has been edited.
  • Multiple translation driver support. See Drivers below.
  • Translate permissions - define any level of access to view translations from Guest users and up to suit your needs.
  • Admin users may force a refresh of any translation, if required.

Screenshots

Regular permissions, English locale, Welsh content.
image

Regular permissions German locale, Welsh content.
image

Translate All permission, English locale, Welsh content.
image

Permission options
image

User preference options

image

Premium

This extension requires an active subscription from extiverse. Once your subscription is active you can follow the instructions on the Extiverse subscriptions page to configure composer. Once completed you can run the following command for installation:

composer require ianm/translate

For updates:

composer update ianm/translate
php flarum migrate
php flarum cache:clear

Installation

After setting up your subscription (above) and installing the extension, it will be pre-configured to use the Google Translate driver. See Drivers for information on how to select and configure drivers.

Once the extension is enabled, any existing forum posts will not have their language detected. This means that the language header for each post will not be displayed, and the available translation options will not be as filtered as normal (ie normally the option to translate a post to the language it was written in is not displayed.). As each post is edited, it's language will be detected and will be stored and only updated if the content changes.

Alternatively, you can use the CLI to process all posts and detect their language ahead of first use. See CLI below.

By default, all users (including guests) may translate post content to that of their current locale, when the post content differs from it.

Drivers

Google Translate

Status: Production ready. Has a fair usage limit of approx 500 translation requests per day (excluding cached translations).

This driver uses Google Translate APIs under the hood, but without any configuration required. Ideal for use in testing environments and small/medium sized communities.

Google Cloud Translate

Status: Production ready. Additional costs via Google Cloud may apply.

Setup steps:

  • Log in to Google Developer Console
  • Create a new Project to contain your translation API, and enable any billing as required.
  • Select Enable API and search for Cloud Translation API and enable it.
  • Click Create Credentials and choose API Key. Give this key a name so you can refer back to it at a later date. Optionally, restrict this key to the translation API only for improved security.
  • Once you have generated your key, copy/paste it into the Google Cloud Translator section of this extension's settings.

DeepL

Status: Beta. Additional costs via DeepL may apply, depending on your chosen plan.

Supports both the DeepL free and Pro variants, formality setting and English "flavour" (en-US or en-GB)

Setup steps:

  • Log in and choose a plan at DeepL
  • Follow the signup steps as described. Note, you will need to enter billing information, even for the free teir.
  • Once you have setup your new account, obtain your API key from DeepL Account Settings and enter it into the relevant setting field in this extension.
  • [optional] set your preferences for Formality and English variant

LibreTranslate

Status: experimental/under development

AWS Translate

Status: planned

Azure Cognitive Services Translator

Status: planned

Yandex Translate

Status: planned

Translation strings

Whilst the user generated content is handled by your chosen translation driver, some of the UI elements of this extension rely on traditional Flarum language packs. Check on the status of your language on weblate

CLI

The following CLI commands are provided by this extension

php flarum translate:detect

This command is used to detect the language in the content attribute of a CommentPost. The content is parsed and sent via the translate API to the current active translator engine. The result is stored on the post detected_lang attribute. eg en if English content is detected.

Only CommentPost items where the detected_lang attribute is null (ie not previously set) will be processed.

Options

--discussion=26 can be appended to the command to only identify the language used in discussion ID 26 (replace the ID as appropriate).

--force can be appended to force a re-detection of the content language.

Both options can be used together if required, eg php flarum translate:detect --discussion=26 --force

FAQs

How are translation updates handled?

When a post is edited, all cached translations are marked as "needing an update". Rather than automatically refreshing all translations for that post, the next time a translation for x language is requested, we call the translation service to provide it seamlessly on demand. This helps to reduce translation costs and server load too.

Future improvements/additions

In addition to the stated additional translation provider drivers, other features may be added over time. These will be driven by subscriber feedback. Accepted and planned improvements will appear here.

Support

Technical support is included in your subscription and is provided in the first instance on Discuss, but can also be provided via email, Discord, etc as required.

Links

Extiverse

    Kylo may I recommend the DeepL as an another driver option?

    Yes, absolutely! In fact, I may bump this one up the development list a little. Great shout 👍

    IanM Fantastic extension! Is there a difference between the one-time purchase subscription vs the annual subscription?

      Lurker For "non-profit" usage, no difference at all. The one-time option is available for early adopters of the extension. I'll probably retire that option at the end of the year for new signups. TBC, of course!

      0.2.0

      ✨ New driver: DeepL

      As suggested by Kylo a driver for DeepL has been added.

      This driver supports:

      • Formality bias for most translations
      • Selection of which flavour of English to use - en-US (default) or en-GB

      I've labelled this driver as beta for now, but I'm reasonably sure it works without issue. Please report if you experience any different! 🤞

      Updating
      composer update ianm/translate
      php flarum cache:clear
      4 days later

      🌠 Black Friday Deal

      From now until 23.59 GMT Monday (November 28, 2022), the lifetime subscription price for this extension is reduced to $35 USD*

      The deal includes all future updates to the extension, as well technical support where required.

      Any questions? Ask away...

      🤟

      To subscribe, or for more information about this extension, visit extiverse

      * Applies to the Standard license for non-profit use only.

        IanM I call dibs on the 1st promo subscription! 😍

          IanM Status: Production ready. Has a fair usage limit of approx 500 translation requests per day (excluding cached translations).

          If I run php flarum cache:clear, does it clear the cached translations on posts as well? Thanks!

          • IanM replied to this.

            Lurker If I run php flarum cache:clear, does it clear the cached translations on posts as well? Thanks!

            No, the cached translations are stored in the database, so not affected by the cache:clear command

              IanM I just tested this now and I must say that it's impressive. With the default Google driver, it easily detects the language and provides the option (based on permission) for on-demand translation. Amazing work! With the ongoing Black Friday deal, I must say that this is a steal! 💰

              Question: How do I enable the dropdown language menu? Do I have to install a separate extension for that one?

              Finding: I tried using a local dialect and since it is very uncommon to be used in forums, I get this line instead: This post is in un instead of the usual This post is in French (if using a common language like French). For reference, I used "Cebuano". The extension is still able to identify it as a foreign language and give the option to translate to English.

                Lurker How do I enable the dropdown language menu? Do I have to install a separate extension for that one?

                The available languages in the dropdown are driven by a couple of factors:

                • The installed language packs (flarum-lang/....)
                • The permission View translation in any forum locale

                Lurker Also, I tried using a local dialect and since it is very uncommon to be used in forums, I get this line instead: This post is in un instead of the usual This post is in French (if using a common language like French). For reference, I used "Cebuano".

                The display of the language name here is driven by the browsers support of Intl.DisplayNames. If the language code cannot be localized, it will fallback to displaying the code itself, rather than leave the text missing

                  IanM I see. Thanks for the explanation. One more question if I may. What would happen if a user hits the fair usage limit?

                  • IanM replied to this.

                    Lurker One more question if I may. What would happen if a user hits the fair usage limit?

                    If the translation is already cached in your database, they would be able to view the translation as normal. If the translation has to be fetched from the provider and the limit has been reached, then they'll see a message saying This translation is not currently available, please try again later.

                    IanM The available languages in the dropdown are driven by a couple of factors

                    Please correct me if I’m wrong. If I wanted to create a bilingual forum, I just need to install and enable 2 language packs then configure the permission level. After that, users will have the option to choose their local language in the forum header and freely translate posts between the 2 languages installed.

                    • IanM replied to this.

                      Review: I did some comparison tests between DeepL and Google Translate and found the following:

                      DeepL

                      • For unsupported languages, the driver displays random languages in the auto-detect line (i.e. "This language is in Indonesian then Slovenian, etc...") and shows the original message in the translation box which is the expected behaviour.
                      • For supported languages, a lot of people prefer this over Google Translate based on online reviews.

                      Google Translate

                      • Due to its wide language support, it's able to provide a good level of translation. For uncommon languages, grammatical mistakes are more frequent but the context is preserved. Despite the errors, it is better than not having any translation at all.
                      • If the language is not found in the Intl.DsiplayNames database, the driver will display "This language is in un." in the auto-detect line.

                      Overall, I would say that the free Google Translate would suffice for most forum needs. The only time I would choose DeepL over Google Translate is when translating longer paragraphs of text where context and tone are considered essential.

                      Verdict: I'm glad I picked this up early. Though I'm still in my setup phase for my forum, I'll keep this as an admin/moderator feature until more multicultural members join. If you're reading this and you're still thinking about it, I say grab this now while the price is right. There will always come a time when you'll need this extension. 👍

                      Bonus Usage: Translate spam posts before deleting them. 😂

                      0.2.1

                      • fix an issue where translations would not display under some circumstances
                      • fix an issue where the language translation dropdown caused undesirable effects on mobile

                      Note: I am aware of an issue when the DeepL driver is in use where the forum response times are increased. A further update will be released shortly to address this.

                      Updating
                      composer update ianm/translate
                      php flarum cache:clear

                      Thanks for the extension! My two cents, if you don't mind: I think some integration of Discussion Language would make sense here? For example to determine the current language - as it doesn't make sense to translate a English-tagged post into English, and also hide hide the option if it's the same language.

                      • IanM replied to this.