Add a native to get player's fivem UI language

As my server is a worldwide server, I daily get a lot of players who don’t speak English so I thought that having my server’s instructions all in English was a bad idea. I already searched for game natives and I found GetCurrentLanguage() (returns the language chosen in GTA V itself) but that is not enough as not everyone knows about this (and it doesn’t support all the languages that FiveM does). However, FiveM launcher already allows players to choose a language at their settings menu so I thought that a new native to get the chosen language would fit my needs.

I made an simple resource that’s returning the system language lang.zip (1.4 KB)

Maybe this will help you, I hope that one-day FiveM implements a global function for getting the player language set in the config.

Although having a function for getting the FiveM client language would be awesome, the only use that I can see for it is to replace a Language Selector menu, since you would still need localization for your resources.

It’d make more sense if we could use FiveM UI language imo. But thanks for your shared script.

Not likely at all, as this won’t cover all languages in existence.

What if you want your server to be available in, say, Hindi, but the main UI isn’t translated in such?

It’s obviously impossible to cover all languages but if you compare what we currently have GetCurrentLanguage() which depends on R* (impossible to translate more languages) and FiveM UI which could be always updated and could support more languages, you would realize that it’s not a bad idea to have such a native.

As an addition, if this native ever gets added, another native that returns all available FiveM languages would be amazing too.

Meanwhile you could present a UI to players when they connect for the first time where they can select their language.