All Languages in a server?

Hello guys. I’m trying to make a gamemode with multi languages supports. There’s any GMOD API for this or should I do this with by my own?

just make variables in an table like



lang = {}
lang.hello = "(Your language) Hello"


In my case, I decided that it was better to make one language to one server at a time.

Sure, support multiple languages, but don’t have a single server with multiple-clients in each language for each user.

Why?

Imagine your gamemode has a Russian user interface for Russians, a French one for people who speak French, etc - well, that’s great! But now you have the problem that when the players start to chat to one another, you’ve got a communication problem anyway.

At least if the user interface is all in the same language for that server, players that can read the user interface will probably be able to understand each other, too.

How to do it? Have a file which defines a lua table:

language.lua (1)



UILanguage = {
    "ButtonTextOK" = "OK",
    "ButtonTextCancel" = "Cancel",
    "WelcomeScreen" = "Welcome to our server! [EN]"
}


language.lua (2)



UILanguage = {
    "ButtonTextOK" = "OK",
    "ButtonTextCancel" = "Cancelar",
    "WelcomeScreenText" = "Bienvenido a nuestro servidor! [ES]"
}


language.lua (3)



UILanguage = {
    "ButtonTextOK" = "OK",
    "ButtonTextCancel" = "Cancelar",
    "WelcomeScreenText" = "Bem-vindo ao nosso servidor! [PT]"
}


Then in your game you can just do something like:



UILanguage["WelcomeScreenText"]


To get back the text in that particular language.

The language is set to english by default IF he is a “good” developer that sets the language to english by default, and then he can make an menu to set the language, so on join they know to talk english etc.

-snip-

If they can speak the language of the other players, they can understand the user interface.

I made a vote about this 2 years ago and overwhelmingly people voted that the language should be fixed for a given server.

You could use this system, or alternatively your own.

What you could do is have a rough translation via google translate API of all chat messages to the selected language of the client.