Localised Info Messages

When you have a chat with people that have different language preferences then It would be cool if app devs could send webxdc info messages that get displayed in the language of the viewing user. Currently it’s only possible to localise the messages for the sending users language before sending it.
This post proposes a way to add dynamic translations.

The proposed api for the app developer

like send sth like

{info: {translate: "player_won", args: [player.name]}}

and have a dict in the apps manifest.toml for the translation strings:

[translations.de]
player_won = "$1%s hat das Spiel gewonnen!"
[translations.en]
player_won = "$1%s won the Game!"

Later the translation strings could also be stored in a specified folder or other format that is more common and easily translated via translation platforms like weblate. But IMO there should still be an easy manual way for small apps to try it out.

How would work

There would be a new way to specify info messages, similar to what we use in deltachat core and in the ui, where you have translatable strings with placeholder variables for values.

DeltaChat would then translate the string when displaying it to the receiver in the receivers preferred language. So it would be sent as key to the translation string + data and only translated at the receiving end. (for backwards compatibility we could also still send a default translation as well)

This will not affect normal description text for other MUAs, which app devs will still send in the senders language.

Original issue for more background: Extend webxdc API for translation · Issue #3746 · deltachat/deltachat-core-rust · GitHub

1 Like

I think it makes sense to take inspiration from how WebExtensions do i18n.

Related issue about app’s description.

1 Like