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

Rafael_Sol_Maker

Almighty God Jabu
Veteran
Joined
May 8, 2012
Messages
122
Reaction score
36
First Language
Portuguese
Primarily Uses
RMMV
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: )

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.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,310
Reaction score
11,911
First Language
English
Primarily Uses
RMMV
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.
 

Rafael_Sol_Maker

Almighty God Jabu
Veteran
Joined
May 8, 2012
Messages
122
Reaction score
36
First Language
Portuguese
Primarily Uses
RMMV
Thanks for the reply, @Shaz! I checked what you said, and I found this:

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.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,310
Reaction score
11,911
First Language
English
Primarily Uses
RMMV
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.
 

ChampX

Veteran
Veteran
Joined
Aug 14, 2016
Messages
185
Reaction score
118
First Language
English
Primarily Uses
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).
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

There's a new born faction in my country called "Sunda Empire" claiming they have right to rule over the earth and sun... I don't know what to feel...
Quon is watching you
Quon blessed your good efforts
I have tried, several times to understand how Markiplier is popular. You can't deny his popularity. I can only get through a few minutes of his vids, though. He's cringier than ANY cringe comp I've ever watched. When I was a kid, if you acted like that, 0 friends and 100% no dates for you. Times have changed XD
Sometimes you may feel helpless and defeated. But everyone loses from time to time. It's okay to be tired. Take a breather. Have a good cry if you need to. You gotta take breaks from your workout, or you'll collapse before you can get stronger.
So, my roommates wrote a news article in English, translated it into Bengali with google translate and now I'm helping them fix the monstrosity which was the result. Making English the medium of education is fine... but not to an extent that we forget how to write properly in our own language :")

Forum statistics

Threads
93,544
Messages
913,362
Members
123,075
Latest member
xCanopus
Top