core/smn_lang.cpp
changeset 1014 26aab5a1e2ba
parent 653 ef60870067ff
child 1034 5ac2c40f13de
     1.1 --- a/core/smn_lang.cpp	Sun Jun 24 21:14:06 2007 +0000
     1.2 +++ b/core/smn_lang.cpp	Sun Jun 24 21:38:02 2007 +0000
     1.3 @@ -14,6 +14,8 @@
     1.4  
     1.5  #include "PluginSys.h"
     1.6  #include "Translator.h"
     1.7 +#include "LibrarySys.h"
     1.8 +#include "sm_stringutil.h"
     1.9  
    1.10  static cell_t sm_LoadTranslations(IPluginContext *pCtx, const cell_t *params)
    1.11  {
    1.12 @@ -23,6 +25,16 @@
    1.13  
    1.14  	pCtx->LocalToString(params[1], &filename);
    1.15  
    1.16 +	/* Check if there is no extension */
    1.17 +	const char *ext = g_LibSys.GetFileExtension(filename);
    1.18 +	if (!ext || (strcmp(ext, "cfg") && strcmp(ext, "txt")))
    1.19 +	{
    1.20 +		/* Append one */
    1.21 +		static char new_file[PLATFORM_MAX_PATH];
    1.22 +		UTIL_Format(new_file, sizeof(new_file), "%s.txt", filename);
    1.23 +		filename = new_file;
    1.24 +	}
    1.25 +
    1.26  	index = g_Translator.FindOrAddPhraseFile(filename);
    1.27  	pl->AddLangFile(index);
    1.28