Acode icon indicating copy to clipboard operation
Acode copied to clipboard

I18n API For Plugin API

Open UnschooledGamer opened this issue 5 months ago • 5 comments

Check for existing issues

  • [x] Completed

Describe the feature

Just drafting this Here, For supporting it. Unsure about how it's supposed to Supported or how it's Implementation should work.

Any Ideas, positive critics are appreciated.

If applicable, add mockups / screenshots to help present your vision of the feature

No response

UnschooledGamer avatar Jul 17 '25 11:07 UnschooledGamer

The plugin.json file can optionally include a reference to a langs directory:

{
  "i18n": "plugin/path/to/langs/directory"
}

This directory should contain language files, following the same structure as src/langs in Acode.

In the plugin init function, Acode will fetch correct language file and provide a strings JSON object containing the localized strings for the current language. The plugin can then use these strings anywhere

for example:

console.log(strings["hello"]);

RohitKushvaha01 avatar Jul 23 '25 14:07 RohitKushvaha01

Interesting 🤔, I didn't include that. As Plugin devs can get-in their own Library too.

As Translators still need to translate The Plugin itself and nothing is related to Acode's side for it.

Nothing as Strong Thoughts 🤔

UnschooledGamer avatar Jul 23 '25 17:07 UnschooledGamer

I think this should be very easy, just a variable to see the app's language and configure the plugin according to the developer's wishes.

It was enough to create a logic for the readme in different languages in the plugin.json pointing to each language, this is very easy to implement

{
  "readme": "README.pt.md",
  "readmes": {
    "en": "README.en.md",
    "pt": "README.pt.md"
  }
}

This way it doesn't break other plugins or developers who don't want to add it.

sebastianjnuwu avatar Aug 17 '25 22:08 sebastianjnuwu

What do you think? They just use i8next and that's it!

sebastianjnuwu avatar Aug 17 '25 22:08 sebastianjnuwu

This feature is needed please look into it

Jobians avatar Sep 05 '25 21:09 Jobians