Jump to content

[HELP CHANGE TRANSLATE]


Recommended Posts

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.

Spoiler

#ifdef ENABLE_MULTI_LANGUAGE_SYSTEM
	for (BYTE locale = 0; locale < LOCALE_MAX_NUM; locale++)
	{
		// g_stLocaleFilename = g_stServiceBasePath + "/" + get_locale_file(locale);
		if (locale == LOCALE_YMIR)
			g_stLocaleFilename = g_stServiceBasePath + "/" + "locale_string.txt";
		else
			g_stLocaleFilename = g_stServiceBasePath + "/country/" + get_locale(locale) + "/" + "locale_string.txt";

		if (g_stLocaleFilename.empty())
			continue;

		fprintf(stderr, "LocaleService %s\n", g_stLocaleFilename.c_str());

		locale_init(g_stLocaleFilename.c_str(), locale);
	}
#else
	fprintf(stderr, "LocaleService %s\n", g_stLocaleFilename.c_str());

	locale_init(g_stLocaleFilename.c_str());
#endif

 

 

Someone can help me with this code ? 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.