Check ingame variable on a plugin?

Let's say i've a variable in game called "Language" in my game. If it's 1, then language is portuguese, if it's 2, english,etc.

How could i check it inside a plugin, to them name something according to the language set in that variable?

EDIT: Also, is that possible? I forgot to ask.
If I am understanding correctly, you are using the standard Variables within the editor to track which language to use.
This code below assumes the indicator is stored in Variable #18 - change it for your variable. Each method also has a default case that assumes Portuguese but that is only a fail-safe in case you forget to define the language. If you are careful to define the language then the default is not needed.
Spoiler: Method 1 - Switch statement
Code:
var text = "";
switch($gameVariables.value(18)) {
    case 1:
        text = "Bom Dia.";
        break;
    case 2:
        text = "Good morning.";
        break;
    case 3:
        text = "Guten Morgen.";
        break;
    default:
        text = "Bom Dia.";
};

Spoiler: Method 2 - If Else If statements
Code:
var text = "";
if($gameVariables.value(18) === 1) {
    text = "Bom Dia.";
} else if ($gameVariables.value(18) === 2) {
    text = "Good morning.";
} else if($gameVariables.value(18) ===3) {
    text = "Guten Morgen.";
} else {
    text = "Bom Dia.";
};
I have read that If-Else statements are marginally faster than Switch statements, but I don't think it will cause a noticeable difference in this context. Pick whichever one is easier for you to read.

How often will you be doing this? I have presented a simple solution above, but if the entire game will be structured like this I believe it could be a lot of work. I am sure there is a more elegant solution that could be more efficient for you.
How often will you be doing this? I have presented a simple solution above, but if the entire game will be structured like this I believe it could be a lot of work. I am sure there is a more elegant solution that could be more efficient for you.
I will use it for Menu only. Everything else i can do easily.

And thank you! It worked perfectly.
If you are careful to define the language then the default is not needed.

I would personally advise to never assume you won't make a mistake. Having a default with perhaps a message log to console would possibly save debugging headaches later.

Original thread: https://forums.rpgmakerweb.com/threads/check-ingame-variable-on-a-plugin.88221/