Feat request : Can Obsidian provides an API to change language

At present i have hardcoded all the string for settings and other fields of my whole plugin code with English language. But when Obsidian changes the Application language, it only changes the core application interface language and the core plugins Interface language.

I was wondering if Obsidian could provide us a function, where we could pass the string we want to display in our settings and at other places which are not possible for user to change and the function will return us the translated version of the passed string into the language which Obsidian is currently set to by the user.

For example :

<div> {ObsidianLangTranslator("This setting helps you to change the language.")}</div>

I understand, Obsidian is also using an offline method, that is by keeping a map of English to all other languages. But, what I am suggesting is, in the same plugin folder, Obsidian can create a new json file, which will have the mapping to English string to all other languages, supported by Obsidian. This file can be created initially using an online translation API, when the plugin was installed. And later the data will be read from this json file for translation.

Hello! You can see i18next in typescript to do so.
Some plugin have already integrated translation, like Enveloppe

1 Like

Yeah, actually I have used a similar method like that one to do the same, since thats the only approach left to implement multi-language functionality. I guess ill move on to i18next.

Thanks for sharing.

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