From 28d24a7f97ad519063846c839f851849ca2c685c Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 24 Jun 2007 21:14:06 +0000 Subject: [PATCH] - renamed translation files from .cfg -> .txt - renamed trans core file to core.phrases.txt - renamed trans common file to common.phrases.txt - added some backwards compat so this doesn't break everyone's plugins --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401019 --- core/Translator.cpp | 13 +++++++++++-- plugins/antiflood.sp | 2 +- plugins/basecommands.sp | 4 ++-- plugins/reservedslots.sp | 2 +- translations/{common.cfg => common.phrases.txt} | 0 translations/{core.cfg => core.phrases.txt} | 0 .../{plugin.antiflood.cfg => plugin.antiflood.txt} | 0 ...gin.basecommands.cfg => plugin.basecommands.txt} | 0 ...n.reservedslots.cfg => plugin.reservedslots.txt} | 0 9 files changed, 15 insertions(+), 6 deletions(-) rename translations/{common.cfg => common.phrases.txt} (100%) rename translations/{core.cfg => core.phrases.txt} (100%) rename translations/{plugin.antiflood.cfg => plugin.antiflood.txt} (100%) rename translations/{plugin.basecommands.cfg => plugin.basecommands.txt} (100%) rename translations/{plugin.reservedslots.cfg => plugin.reservedslots.txt} (100%) diff --git a/core/Translator.cpp b/core/Translator.cpp index d14baa70..9b40eac8 100644 --- a/core/Translator.cpp +++ b/core/Translator.cpp @@ -105,10 +105,18 @@ void CPhraseFile::ReparseFile() char path[PLATFORM_MAX_PATH]; g_SourceMod.BuildPath(Path_SM, path, PLATFORM_MAX_PATH, "translations/%s", m_File.c_str()); - /* :HACKHACK: If we're looking for a .txt, see if a .cfg also exists if our .txt does not. */ + //backwards compatibility shim + /* :HACKHACK: Change .cfg/.txt and vice versa for compatibility */ if (!g_LibSys.PathExists(path)) { - UTIL_ReplaceAll(path, sizeof(path), ".txt", ".cfg"); + if (m_File.compare("common.cfg") == 0) + { + UTIL_ReplaceAll(path, sizeof(path), "common.cfg", "common.phrases.txt"); + } else if (strstr(path, ".cfg")) { + UTIL_ReplaceAll(path, sizeof(path), ".cfg", ".txt"); + } else if (strstr(path, ".txt")) { + UTIL_ReplaceAll(path, sizeof(path), ".txt", ".cfg"); + } } unsigned int line=0, col=0; @@ -660,6 +668,7 @@ void Translator::OnSourceModAllInitialized() unsigned int id; + //backwards compatibility shim /* hack -- if core.cfg exists, exec it instead. */ char path[PLATFORM_MAX_PATH]; g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "translations/core.cfg"); diff --git a/plugins/antiflood.sp b/plugins/antiflood.sp index d451c637..d84ed39e 100644 --- a/plugins/antiflood.sp +++ b/plugins/antiflood.sp @@ -40,7 +40,7 @@ new Handle:sm_flood_time; /* Handle to sm_flood_time convar */ public OnPluginStart() { - LoadTranslations("plugin.antiflood.cfg"); + LoadTranslations("plugin.antiflood.txt"); RegConsoleCmd("say", CheckChatFlood); RegConsoleCmd("say_team", CheckChatFlood); diff --git a/plugins/basecommands.sp b/plugins/basecommands.sp index eea42031..14813391 100644 --- a/plugins/basecommands.sp +++ b/plugins/basecommands.sp @@ -39,8 +39,8 @@ new Handle:hBanRemoved = INVALID_HANDLE; public OnPluginStart() { - LoadTranslations("common.cfg"); - LoadTranslations("plugin.basecommands.cfg"); + LoadTranslations("common.phrases.txt"); + LoadTranslations("plugin.basecommands.txt"); RegAdminCmd("sm_kick", Command_Kick, ADMFLAG_KICK, "sm_kick <#userid|name> [reason]"); RegAdminCmd("sm_map", Command_Map, ADMFLAG_CHANGEMAP, "sm_map "); RegAdminCmd("sm_rcon", Command_Rcon, ADMFLAG_RCON, "sm_rcon "); diff --git a/plugins/reservedslots.sp b/plugins/reservedslots.sp index bbec6a0c..5fc61aa4 100644 --- a/plugins/reservedslots.sp +++ b/plugins/reservedslots.sp @@ -43,7 +43,7 @@ new Handle:sv_visiblemaxplayers; public OnPluginStart() { - LoadTranslations("plugin.reservedslots.cfg"); + LoadTranslations("plugin.reservedslots.txt"); sm_reserved_slots = CreateConVar("sm_reserved_slots", "0", "Number of reserved player slots", 0, true, 0.0); sm_hide_slots = CreateConVar("sm_hide_slots", "0", "If set to 1, reserved slots will hidden (subtracted from the max slot count)", 0, true, 0.0, true, 1.0); diff --git a/translations/common.cfg b/translations/common.phrases.txt similarity index 100% rename from translations/common.cfg rename to translations/common.phrases.txt diff --git a/translations/core.cfg b/translations/core.phrases.txt similarity index 100% rename from translations/core.cfg rename to translations/core.phrases.txt diff --git a/translations/plugin.antiflood.cfg b/translations/plugin.antiflood.txt similarity index 100% rename from translations/plugin.antiflood.cfg rename to translations/plugin.antiflood.txt diff --git a/translations/plugin.basecommands.cfg b/translations/plugin.basecommands.txt similarity index 100% rename from translations/plugin.basecommands.cfg rename to translations/plugin.basecommands.txt diff --git a/translations/plugin.reservedslots.cfg b/translations/plugin.reservedslots.txt similarity index 100% rename from translations/plugin.reservedslots.cfg rename to translations/plugin.reservedslots.txt