Jump to content
  • 0

[HELP CHANGE TRANSLATE]


Dalyn

Question

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 post

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • 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.