游戏中的多语言设置问题

时间:2015-01-10 23:08:34

标签: c++ windows multilingual

我已添加了在此游戏中选择多种语言的功能,但我遇到了一些问题。主要问题是如果一个玩家选择了英语,而另一个选择了日语,则日语玩家可以阅读英语,但英语玩家无法阅读他们的语言。在游戏启动时,从名为config.xml的xml中读取所选语言(它获取代码的子代码),然后根据选择的语言从那里读取,转到文件夹并以xmls语言加载。有没有办法同时喜欢,嵌入或加载所有语言,这样玩家可以阅读韩文/日文文本,而不是一堆问号?

代码:

void ZLanguageSetting_formultilanguage::SetLanguageIndexFromCmdLineStr(const char* cmdline)
{
const unsigned int id_USA = 0;
const unsigned int id_DUT = 1;
const unsigned int id_SPA = 2;
const unsigned int id_POR = 3;
const unsigned int id_GER = 4;
const unsigned int id_KOR = 5;
const unsigned int id_JAP = 6;

m_idLang = id_USA;

if (NULL == cmdline) return;

if      (NULL!= strstr(cmdline, "&u100e:2=en")) m_idLang = id_USA;
else if (NULL!= strstr(cmdline, "&u100e:2=du")) m_idLang = id_DUT;
else if (NULL!= strstr(cmdline, "&u100e:2=sp")) m_idLang = id_SPA;
else if (NULL!= strstr(cmdline, "&u100e:2=po")) m_idLang = id_POR;
else if (NULL!= strstr(cmdline, "&u100e:2=ge")) m_idLang = id_GER;
else if (NULL!= strstr(cmdline, "&u100e:2=ko")) m_idLang = id_POR;
else if (NULL!= strstr(cmdline, "&u100e:2=ja")) m_idLang = id_GER;
}

ZLanguageSetting_formultilanguage g_LanguageSettingformultilanguage;
ZLanguageSetting_formultilanguage* ZGetLanguageSetting_formultilanguage()
                                    { return &g_LanguageSettingformultilanguage; }

const char* ZConfiguration::GetLanguagePath()
{
    switch (GetSelectedLanguageIndex())
    {
     case 1:
        return PATH_DUT;
     case 2:
        return PATH_SPA;
     case 3:
        return PATH_POR;
     case 4:
        return PATH_GER;
     case 5:
        return PATH_KOR;
     case 6:
        return PATH_JAP;
     case 7:
        return PATH_USA;
     default:
        return PATH_DEFAULT;
    }
}

这是从cmdline中选择的代码的基础,然后将包含xmls的其中一个路径加载到内存中。希望这个帖子有所有必要的信息,如果没有,我会根据需要更新。感谢

1 个答案:

答案 0 :(得分:0)

问题是程序很老,不使用Unicode,使用MBCS,将所有内容转换为Unicode需要太长时间,所以我删除了日语和韩语。