Allow users to translate plugins

Use case or problem

There are a lot of plugins out there, and it would take a lot of (unrealistic) effort for developers to translate their plugins into every language that Obsidian provides.

Proposed solution

Allow users to translate/localize the plugins they have installed.

Add a table in the settings where the users can translate the texts for their installed plugins.

This shouldn’t require any changes to the current code of any plugin.

Optional

There could be a new API function for future plugins to add texts to the translation table for texts that aren’t shown in the UI (DOM tree).

addToDictionary(plugin: Plugin, textID: string);  // Adds text that can be translated
dict = getDictionary(plugin: Plugin);  // Returns the dictionary for the plugin
dict["textID"]  // Returns localized text or default English text equal to textID if there is no translation

Optional:

There could be a “Send to Obsidian” button to send the translation to the Obsidian server. Then Obsidian could manage the translations in a download list within the settings with kudos from other users.

(The downloaded text needs to be sanitized to avoid code injections.)

Current workaround

Probably by changing the UI texts in the JavaScript files in the .plugins folder. But when a plugin gets an update its files get overwritten.

Perhaps it’s better to change the UI texts during runtime.

Related feature requests

What is translated and what is not translated is something for plugin devs to manage themselves.
They can implement an i18n library/code snippet to manage the translation files and ask for pull requests.
We could maybe provide some helper functions though, like the linked thread asks for.

Your proposed solution won’t work, not all the strings in a plugin should be translated, and changing text at runtime is hacky.
The second optional feature is not something we will implement.

Thank you.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.