.txt is now assumed for LoadTranslations() when no extension exists
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401020
This commit is contained in:
parent
28d24a7f97
commit
ca3d74be45
@ -14,6 +14,8 @@
|
||||
|
||||
#include "PluginSys.h"
|
||||
#include "Translator.h"
|
||||
#include "LibrarySys.h"
|
||||
#include "sm_stringutil.h"
|
||||
|
||||
static cell_t sm_LoadTranslations(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
@ -23,6 +25,16 @@ static cell_t sm_LoadTranslations(IPluginContext *pCtx, const cell_t *params)
|
||||
|
||||
pCtx->LocalToString(params[1], &filename);
|
||||
|
||||
/* Check if there is no extension */
|
||||
const char *ext = g_LibSys.GetFileExtension(filename);
|
||||
if (!ext || (strcmp(ext, "cfg") && strcmp(ext, "txt")))
|
||||
{
|
||||
/* Append one */
|
||||
static char new_file[PLATFORM_MAX_PATH];
|
||||
UTIL_Format(new_file, sizeof(new_file), "%s.txt", filename);
|
||||
filename = new_file;
|
||||
}
|
||||
|
||||
index = g_Translator.FindOrAddPhraseFile(filename);
|
||||
pl->AddLangFile(index);
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
/**
|
||||
* Loads a translation file for the plugin calling this native.
|
||||
* If no extension is specified, .txt is assumed.
|
||||
*
|
||||
* @param path Translation file.
|
||||
* @noreturn
|
||||
|
Loading…
Reference in New Issue
Block a user