Hello Friend's , I need help with that. I need when i change language , choose the correct translate.lua
My translate i have in that directory /home/eterny2/main/srv1/share/locale/germany/country/ro ( for example this is ro )
The code is that :
#ifdef ENABLE_TRANSLATE_LUA
{
char translateFileName[256];
snprintf(translateFileName, sizeof(translateFileName), "%s/translate.lua", LocaleService_GetBasePath().c_str());
int translateLoadingResult = lua_dofile(L, translateFileName);
sys_log(0, "LoadTranslate(%s), returns %d", translateFileName, translateLoadingResult);
if (translateLoadingResult != 0)
{
sys_err("LOAD_TRANSLATE_ERROR(%s)", translateFileName);
return false;
}
}
#endif
And my change is that :
#define ENABLE_TRANSLATE_LUA
#ifdef ENABLE_TRANSLATE_LUA
{
char translateFileName[256];
#ifdef ENABLE_MULTI_LANGUAGE_SYSTEM
for (BYTE locale = 0; locale < LOCALE_MAX_NUM; locale++)
{
if (locale == LOCALE_YMIR)
g_stLocale = g_stLocale + "/" + "translate.lua";
else
g_stLocale = g_stLocale + "/country/" + get_locale(locale) + "/" + "translate.lua";
if (g_stLocaleFilename.empty())
continue;
#else
snprintf(translateFileName, sizeof(translateFileName), "%s/translate.lua", LocaleService_GetBasePath().c_str());
#endif
int translateLoadingResult = lua_dofile(L, translateFileName);
sys_log(0, "LoadTranslate(%s), returns %d", translateFileName, translateLoadingResult);
if (translateLoadingResult != 0)
{
sys_err("LOAD_TRANSLATE_ERROR(%s)", translateFileName);
return false;
}
}
}
#endif
Compile good , but dont read the translate on this directory ... maybe i am in wrong part of code.
But my language when i change the languages , work fine with locale_string.txt , mob_proto.txt , item_proto.txt
That is the example from the locale_string.txt and works good.
Someone can help me with this code ?