-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #269 from GMLambda/lang
Localization
- Loading branch information
Showing
18 changed files
with
263 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
local DbgPrint = GetLogging("Language") | ||
|
||
local SUPPORTED_LANGUAGES = { | ||
["en"] = "english", | ||
} | ||
|
||
local function GetCurrentLanguage() | ||
local gmod_language = GetConVar("gmod_language") | ||
local lang = gmod_language:GetString() | ||
local realLang = SUPPORTED_LANGUAGES[lang] | ||
if realLang == nil then | ||
DbgPrint("Language '" .. lang .. "' is not supported, falling back to 'en'") | ||
realLang = "english" | ||
end | ||
return realLang | ||
end | ||
|
||
function GM:LoadLocalisation() | ||
local langName = GetCurrentLanguage() | ||
local gameType = self:GetGameType() | ||
if gameType == nil then return end | ||
while gameType ~= nil do | ||
local langData = gameType.Localisation | ||
if langData ~= nil then | ||
local langEntries = langData[langName] | ||
if langEntries ~= nil then | ||
for k, v in pairs(langEntries) do | ||
DbgPrint("Adding localisation: " .. k .. " = " .. v) | ||
language.Add(k, v) | ||
end | ||
end | ||
end | ||
gameType = gameType.Base | ||
end | ||
end | ||
|
||
cvars.AddChangeCallback("gmod_language", function(cvar, old, new) | ||
GAMEMODE:LoadLocalisation() | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
if SERVER then AddCSLuaFile() end | ||
local LOCALISATION = {} | ||
LOCALISATION["english"] = { | ||
["World"] = "Cruel World", | ||
["base_ai"] = "Creature", | ||
["Valve_Hint_EnterVan"] = "%+use% ENTER VAN", | ||
["Valve_Hint_ExitVan"] = "%+use% EXIT VAN", | ||
["Valve_Hint_Crouch"] = "%+duck% CROUCH", | ||
["Valve_Hint_Sprint"] = "%+speed% SPRINT", | ||
["Valve_Hint_PushButton"] = "%+use% PUSH BUTTON", | ||
["Valve_Hint_PicKUp"] = "%+use% PICK UP", | ||
["Valve_Hint_Interact"] = "%+use% INTERACT", | ||
["Valve_Hint_GravGun"] = "%+attack% PUNT OBJECT %+attack2% PULL OBJECT", | ||
["Valve_Hint_CarryTurret"] = "%+use% OR GRAVITY GUN TO PICK UP TURRET", | ||
["Valve_Hint_CROSSBOW"] = "%+attack2% CROSSBOW ZOOM", | ||
["GM_DIFFICULTY"] = "Difficulty level", | ||
["GM_DIFFICULTY_DESC"] = "Set the gametype difficulty", | ||
["GM_WALKSPEED"] = "Walk speed", | ||
["GM_WALKSPEED_DESC"] = "Set speed when slowly walking with ALT key", | ||
["GM_NORMSPEED"] = "Normal speed", | ||
["GM_NORMSPEED_DESC"] = "Set speed normal walk speed", | ||
["GM_SPRINTSPEED"] = "Sprint speed", | ||
["GM_SPRINTSPEED_DESC"] = "Set running speed", | ||
["GM_CONNECTTIMEOUT"] = "Connection timeout", | ||
["GM_CONNECTTIMEOUT_DESC"] = "Set how long should it wait for connecting players", | ||
["GM_PLAYERCOLLISION"] = "Player collision", | ||
["GM_PLAYERCOLLISION_DESC"] = "Players can collide with other players", | ||
["GM_FRIENDLYFIRE"] = "Friendly fire", | ||
["GM_FRIENDLYFIRE_DESC"] = "Enable damage to other players", | ||
["GM_PREVENTITEMMOVE"] = "Prevent item moving", | ||
["GM_PREVENTITEMMOVE_DESC"] = "Prevent items from moving when shooting at them", | ||
["GM_DEFAMMO"] = "Limit default ammo", | ||
["GM_DEFAMMO_DESC"] = "Disable ammo limits", | ||
["GM_AUTOJUMP"] = "Allow auto jump", | ||
["GM_AUTOJUMP_DESC"] = "Allow players to use the auto jump feature", | ||
["GM_RESPAWNTIME"] = "Respawn time", | ||
["GM_RESPAWNTIME_DESC"] = "Set players respawn time", | ||
["GM_CHECKPOINT_RESPAWN"] = "Checkpoint respawn", | ||
["GM_CHECKPOINT_RESPAWN_DESC"] = "Players have to wait for checkpoints in order to respawn", | ||
["GM_RESTARTTIME"] = "Restart time", | ||
["GM_RESTARTTIME_DESC"] = "Set time between round ending and starting", | ||
["GM_MAPCHANGETIME"] = "Mapchange time", | ||
["GM_MAPCHANGETIME_DESC"] = "Set time after between map finish and level change", | ||
["GM_CHECKPOINTTIMEOUT"] = "Checkpoint timeout", | ||
["GM_CHECKPOINTTIMEOUT_DESC"] = "Set how long checkpoints wait for other players", | ||
["GM_GODMODE"] = "Godmode", | ||
["GM_GODMODE_DESC"] = "Enable god mode, prevents any damage", | ||
["GM_PICKUPDELAY"] = "Pickup delay", | ||
["GM_PICKUPDELAY_DESC"] = "Set weapon/item delay before picking it up", | ||
["GM_DIFFMETRICS"] = "NPC/Player metrics", | ||
["GM_DIFFMETRICS_DESC"] = "Metrics for use by developers", | ||
["GM_WEAPONDROP"] = "Weapon drop mode", | ||
["GM_WEAPONDROP_DESC"] = "Change what players drop on death", | ||
["GM_CHANGELVLDELAY"] = "Level change delay", | ||
["GM_CHANGELVLDELAY_DESC"] = "The amount in seconds to wait before changing to the next map", | ||
["GM_COCKROACHES"] = "Cockroach amount", | ||
["GM_COCKROACHES_DESC"] = "The maximum amount of cockroaches that can be spawned. 0 to disable them", | ||
["GM_ABH"] = "Accelerated backhopping", | ||
["GM_ABH_DESC"] = "Enable ABH, widely used by speedrunners to achieve insane speed", | ||
["GM_DYNCHECKPOINT"] = "Dynamic checkpoints", | ||
["GM_DYNCHECKPOINT_DESC"] = "Enable dynamic checkpoints", | ||
["GM_NPCDMG"] = "Friendly NPC damage", | ||
["GM_NPCDMG_DESC"] = "Allows friendly NPC to take damage", | ||
["GM_PLYTRACK"] = "Player tracking", | ||
["GM_PLYTRACK_DESC"] = "Allows seeing players through walls", | ||
["GM_ANTLIONCOLLISION"] = "Friendly antlion collision", | ||
["GM_ANTLIONCOLLISION_DESC"] = "Enable/disable colliding with friendly antlions", | ||
["GM_PLAYERSPEECH"] = "Player speech", | ||
["GM_PLAYERSPEECH_DESC"] = "Enable/disable players speaking based on performance", | ||
["GM_PLAYERHURTSOUNDS"] = "Player damage speech", | ||
["GM_PLAYERHURTSOUNDS_DESC"] = "Enable/disable players speaking based on recieved damage", | ||
["GM_DM_FRAGLIMIT"] = "Score limit", | ||
["GM_DM_FRAGLIMIT_DESC"] = "Set score limit for round to end", | ||
["GM_DM_TIMELIMIT"] = "Round time limit", | ||
["GM_DM_TIMELIMIT_DESC"] = "Set how long the round lasts", | ||
["GM_DM_TEAMONLY"] = "Team based deathmatch", | ||
["GM_DM_TEAMONLY_DESC"] = "Switch between DM or TDM", | ||
} | ||
return LOCALISATION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.