Hello everyone,
I'm working on a translation extension that will be made available as a premium extension later this year.
Here's how I'm planning to have it work:
- Select a translation engine (DeepL and Google Translate support planned at first)
- Select target languages based on what is offered by the engine
- Whenever a post is created or modified, it's translated into all of the target languages in the background using the selected engine
- When browsing the discussion, if a translation exists for the current interface language it will be shown, otherwise the original post will be shown
- Each user will have the ability to select languages they don't want translated in addition to the interface language.
Some additional display options should be available:
- Show original by default instead of translation, with translation available via a "Translate" button (all translations will always be generated in advance whatever is chosen here)
- Automatic detection of browser language instead of applying the same default to everyone
- Either translate while preserving formatting, or translate as plain text. Full formatting support should be possible with DeepL, but will probably be limited or unavailable using Google Translate
Moderators will have access to additional features:
- Ability to specify the source language of posts
- Ability to provide a manual translation, or edit an automated translation
There is one thing I have not fully decided how to handle yet: country variation of languages like en_US and en_GB, or pt_PT and pt_BR. Is anyone running a community using multiple of such languages? Do you think it's a common enough use case to allow enabling multiple of them at the same time?
I have personally no experience at all working with such languages (well, except for Swiss German vs German, but no translation API has Swiss German). I kind of know that for English there is not that much difference and offering a single one at a time probably won't be too bad, but I suspect that for other languages, the variation could be much more pronounced, but could it be to the point you want to translate your forum in both variations at the same time?
The problem mostly comes down to mapping those languages to language packs. Since I don't plan to replace the way language packs and Flarum locale selection work, if you wanted to enable both en_US and en_GB on the forum, you would also need to create two new language packs.
There's also the "inverse" situation where you might want to match translations with language packs that are technically not the same, like for example using the Brazilian Portuguese language pack together with pt_PT. Is that something one might do, considering not all target languages might have an exact language pack match?
My plan is to make some sort of language pack manager in the extension where for each enabled language pack, you select which of the translations should be preferred. This would even allow choosing a fallback, for example to specify German will not be translated but they should see English translation instead of the original language of a post.
The plan to handle country variations is to offer some kind of virtual language packs, where you can duplicate an existing language pack and assign it a new country code. I'm thinking of making this its own extension, since it could also be used in combination with Linguist to customize some strings based on country without requiring forking the full language pack.
Some more context: this extension will first be used for one of my own projects in Switzerland to implement a forum where all users can interact with EN,DE,FR,IT in the same discussions. I have also received interest from other parties to use the extension which is why I will try to release it as a premium extension soon after it's ready.
Regarding cost, the extension will be available at monthly/yearly plans like my other extensions. The forum owner will need to purchase the DeepL/Google subscription separately.
Any feedback is welcome! I know languages are a vast and complex subject and I really want to make this extension as useful as possible!