Detect which language of MV is being used by the plugin user

Hello everyone,

I think this questions was already asked for someone. Well, I'm guessing. I tried searching for it, but I couldn't find anything.

I don't know how to determine which language the final user of my plugins is using its RPG Maker MV. I want to know that so I can display some error messages in the proper language.

So I can do this...
Code:
throw new Error("Erro: O índice do herói escolhido não está configurado.");
...in my go'old portuguese and in english as well.

I already know that I can use different headers for each language.
(Well, I wrote about it in my e-magazine: )
Spoiler
Uulg8GG.png

But nothing specifically comes here to determine which language is being used other than doing an overly complicated arrange of plugin parameters to try to guess.

I'm still trying to search a simpler answer in the base code, but no luck yet.

Any advices? Thanks for your time.
Window_NameInput uses functions in Game_System to determine the language. However, it's based on $dataSystem, which could be what the developer sets up when they deploy.
Thanks for the reply, @Shaz! I checked what you said, and I found this:
Spoiler
EYsqPQk.png

Hopefully I can try the same test to see if I can spot portuguese data system. I will need to change some configs here, maybe in Steam, maybe my system language.

After the tests I will let everyone knows if I succeed.

Hopefully it's related to the RPG Maker MV the user use and not just only some gimmick to show special characters in Name Input screen.
The thing is, $dataSystem comes from the System tab in the editor, and is saved in System.json

I suspect that may be the locale that's set on the developer's PC, not on the player's. There is nothing I can see that indicates it pulls the information from the player's PC.

If that's true, then it wouldn't be a reliable test for your purpose.
You can use navigator.language to return a locale code representing the language the installed browser is using. I have changed my system locale in the past and it did return the appropriate locale code. Since MV uses chromium under the hood, you do not need to worry about cross browser compatibility (unless you do a web deployment that is).

Original thread: https://forums.rpgmakerweb.com/threads/detect-which-language-of-mv-is-being-used-by-the-plugin-user.95668/