Working Multilanguage (jorklenis2 fix)

Page 1 of 2 12 LastLast
Results 1 to 15 of 29
  1. #1
    TBF Guru jetman82 is offline
    MemberRank
    Jan 2009 Join Date
    631Posts

    Working Multilanguage (jorklenis2 fix)

    So, the gentleman that released multilanguage awhile back posted about an issue with it. Apparently, his version would give you question marks if you changed the language (this is due to the folderpath not being found I assume, or not being applied correctly). I'm going to be releasing my version that does work correctly.


    Step 1:
    Get the locale.xml data from Jorklenis' link.
    Code:
    http://forum.ragezone.com/f245/system-multi-language-1024977/
    Also, follow teh steps in his guide to re-enable the widget (don't use his cpp's/headers)
    Step 2:
    After you've completed that, open ZConfiguration.cpp & ZConfiguration.h

    Code:
    Replace the top lines of zconfiguration.cpp with this:
    #include "stdafx.h"
    //By Jorklenis2 and MAET
    #include "ZConfiguration.h"
    #include "Mint.h"
    #include "ZInterface.h"
    //#include "ZGameInterface.h"
    #include "ZLocatorList.h"
    #include "ZGameTypeList.h"
    #include "ZLocale.h"
    
    ZConfiguration	g_Configuration;
    ZConfiguration* ZGetConfiguration()		{ return &g_Configuration; }
    
    #ifdef LOCALE_BRAZIL
    	LANGID LangID = LANG_PORTUGUESE;		/* Brazil */
    #elif LOCALE_JAPAN
    	LangID = LANG_JAPANESE;					/* Japanese */
    #elif  LOCALE_US
    	LangID = LANG_ENGLISH;					/* International */
    #elif LOCALE_KOREAN
    	LangID = LANG_KOREAN;			        /* Korean */
    #elif  LOCALE_INDIA
    	LangID = LANG_ENGLISH;					/* India */
    #endif
    
    
    
    unsigned int ZLanguageSetting_forNHNUSA::m_idLang = 0;
    
    void ZLanguageSetting_forNHNUSA::SetLanguageIndexFromCmdLineStr(const char* cmdline)
    {
    	// -¾ð¾îº° id´Â ÇϵåÄÚµù;-
    	// xml\usa\locale.xml ¿¡ ÀÖ´Â ¼±Åð¡´ÉÇÑ ¾ð¾î ¸ñ·Ï¿£ ´ÙÀ½°ú °°Àº À妽º°¡ ÁöÁ¤µÇ¾î ÀÖ´Ù
    	const unsigned int id_USA = 0;
    	const unsigned int id_POR = 1;
    	const unsigned int id_SPA = 2;
    
    	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=po")) m_idLang = id_POR;
    	else if (NULL!= strstr(cmdline, "&u100e:2=sp")) m_idLang = id_SPA;
    }
    
    ZLanguageSetting_forNHNUSA g_LanguageSettingForNHNUSA;
    ZLanguageSetting_forNHNUSA* ZGetLanguageSetting_forNHNUSA() { return &g_LanguageSettingForNHNUSA; }
    Next, find this:
    aRootElement.AppendText("\n");
    add this below it:
    
    #ifdef LOCALE_BRAZIL
    	LANGID LangID = LANG_PORTUGUESE;		/* Brazil */
    #elif LOCALE_JAPAN
    	LangID = LANG_JAPANESE;					/* Japanese */
    #elif  LOCALE_US
    	LangID = LANG_ENGLISH;					/* International */
    #elif LOCALE_KOREAN
    	LangID = LANG_KOREAN;			        /* Korean */
    #elif  LOCALE_INDIA
    	LangID = LANG_ENGLISH;					/* India */
    #endif
    
    return xmlConfig.SaveToFile(szFileName);
    
    In ZConfiguration.cpp, search for this:
    unsigned int ZConfiguration::GetSelectedLanguageIndex()
    Above it, add this:
    const char* ZConfiguration::GetLanguagePath()
    {
    	switch (GetSelectedLanguageIndex())
    	{
    	case 1:
    		return PATH_USA;
    	case 2:
    		return PATH_SPA;
    	case 3:
    		return PATH_POR;
    	default:
    		return PATH_USA;
    	}
    }
    Code:
    In ZConfiguration.h, search for this:
    	unsigned int GetSelectedLanguageIndex();
    above it, add this:
    	const char* GetLanguagePath();
    Step 3:
    Now that the language folderpath code is in place, it's time to do some changes to ZFilePath.h
    Code:
    In ZFilePath.h, search for system/tips.xml, remove system/ from that so it only reads tips.xml
    Next in this step is adding the new folderpaths.

    Code:
    In ZFilePath.h, search for this:
    #define	PATH_INTERFACE					"Interface/"
    above it, add this:
    #define PATH_USA						"system/USA/"
    #define PATH_SPA						"system/SPA/"
    #define PATH_POR						"system/POR/"
    Step 4:
    Now that all that's done, the next step is to change some functions so the filepaths will load correctly (this also allows you to remove messages,tips, cserror, and strings from the main container in system.mrs, thus reducing filesize).
    Open ZStringResManager.cpp,
    search for this:
    if (ZGetConfiguration()->IsComplete() && ZGetLocale()->bIsComplete())


    Replace the entire if statement(brackets as well), with this:
    if (ZGetConfiguration()->IsComplete() && ZGetLocale()->bIsComplete())
    {
    if (!m_Messages.Initialize(strFileName.c_str(), ZGetLocale()->GetLanguage(), m_pFS))
    {
    _ASSERT(0);
    char szPath[32] = "system/USA/messages.xml";
    if (!m_Messages.Initialize(szPath, ZGetLocale()->GetLanguage(), m_pFS))
    {
    mlog("Error!! - Messages Initalize Failed\n");
    return false;
    }
    }
    }
    Next, open MBaseStringResManager.cpp:
    Search for this:
    bool MBaseStringResManager::Init(const char* szPath, const int nLangID, MZFileSystem* pfs )

    Replace the entire function with this one:

    bool MBaseStringResManager::Init(const char* szPath, const int nLangID, MZFileSystem* pfs )
    {
    m_strPath = szPath;
    m_pFS = pfs;

    string strFileName;

    // string table
    strFileName = m_strPath + FILENAME_STRING_TABLE;
    if (!m_StringTable.Initialize(strFileName.c_str(), nLangID, pfs))
    {
    _ASSERT(0);
    char szPath[32] = "system/USA/strings.xml";
    if (!m_StringTable.Initialize(szPath, nLangID, pfs))
    {
    mlog("Error!! - StringTable Initalize Failed\n");
    return false;
    }
    }
    // error table
    strFileName = m_strPath + FILENAME_ERROR_TABLE;
    if (!m_ErrorTable.Initialize(strFileName.c_str(), nLangID, pfs))
    {
    _ASSERT(0);
    char szPath[32] = "system/USA/cserror.xml";
    if (!m_ErrorTable.Initialize(szPath, nLangID, pfs))
    {
    mlog("Error!! - ErrorTable Initalize Failed\n");
    return false;
    }
    }

    bool ret = OnInit();
    return ret;
    }
    Finally, open ztips.cpp:
    Code:
    Under MZFile mzf; add this:
    	char szTipsPath[64];
    	sprintf(szTipsPath, "%s%s", ZGetConfiguration()->GetLanguagePath(), FILENAME_TIPS);
    
    replace the if(!mzf.open) statement with this one:
    	if (!mzf.Open(szTipsPath, pfs))
    		return false;
    Step 5:
    Launch the client, and make sure all of the code works correctly. If it does, you can now remove strings.xml, cserror.xml, messages.xml, and tips.xml from your base container path in system.mrs. The benefit of the doublecheck implementation is it allows matchserver.exe & gunz.exe to both find the xml's correctly without having to change the code back to normal, build matchserver, and then change the code back to the modified to build gunz. It searches the original path first, then if the xml isn't found, it searches again. Let me know if you guys have any problems with the code.

    Step 6.
    Right Click on the gunz solution, open properties. Click Configuration properties, then c/c++, then click on preprocessor. Add this to the processor definitions:

    _MULTILANGUAGE

    Credits:
    Lib: for showing me how to do a switch way back then lol, thanks bro, you're always such a big help.
    Jorkenlis2 : for making that tutorial so mine could be much shorter :p
    Last edited by jetman82; 18-05-15 at 01:10 AM.


  2. #2
    DRGunZ 2 Creator wesman2232 is offline
    MemberRank
    Jan 2007 Join Date
    Erie, PALocation
    4,872Posts

    Re: Working Multilanguage (jorklenis2 fix)

    Beasty code.

  3. #3
    TBF Guru jetman82 is offline
    MemberRank
    Jan 2009 Join Date
    631Posts

    Re: Working Multilanguage (jorklenis2 fix)

    Quote Originally Posted by wesman2232 View Post
    Beasty code.
    haha idk about that, although I do like my doublecheck implementation. :P

  4. #4
    Account Upgraded | Title Enabled! Arenbunny is offline
    MemberRank
    Mar 2013 Join Date
    Peru - AyacuchoLocation
    273Posts

    Re: Working Multilanguage (jorklenis2 fix)

    I doubt that this will solve some problem.

  5. #5
    TBF Guru jetman82 is offline
    MemberRank
    Jan 2009 Join Date
    631Posts

    Re: Working Multilanguage (jorklenis2 fix)

    Quote Originally Posted by Arenbunny View Post
    I doubt that this will solve some problem.
    Doubt it all you want, I've had it in the DRGunZ source for atleast 4 months. I already tested it with multiple languages, dr has 6, they all function correctly.

    Edit: but, if you would like to see it in action, i can always upload a vid to my yt channel and link it here.

  6. #6
    Account Upgraded | Title Enabled! Arenbunny is offline
    MemberRank
    Mar 2013 Join Date
    Peru - AyacuchoLocation
    273Posts

    Re: Working Multilanguage (jorklenis2 fix)

    Quote Originally Posted by jetman82 View Post
    Doubt it all you want, I've had it in the DRGunZ source for atleast 4 months.
    I just had to address some things well as defining for each language and was not ready necesirio add so much.


    not need any of this. and I come one year working with this.

  7. #7
    TBF Guru jetman82 is offline
    MemberRank
    Jan 2009 Join Date
    631Posts

    Re: Working Multilanguage (jorklenis2 fix)

    Quote Originally Posted by Arenbunny View Post
    I just had to address some things well as defining for each language and was not ready necesirio add so much.


    not need any of this. and I come one year working with this.
    Havin a bit of trouble understanding what you're saying. It's not really adding much at all, it's only 1 extra function + 8-10 additional lines. PLus you get the benefit of not needing the xmls in the base container path like jord's requires, as well as allowing for many more languages to be easily added. Add 1 case + 1 define in zfilepath.cpp & you have your new languagepath :p

    Although you coud be completly right, there coudl be a much easier way of doing it, I'm sure there probably is, but this is the way i came up with 4 months ago, & if it works why bother going back & changing it. If it aint broke don't fix it :P
    Last edited by jetman82; 06-03-15 at 04:40 AM.

  8. #8
    Account Upgraded | Title Enabled! Arenbunny is offline
    MemberRank
    Mar 2013 Join Date
    Peru - AyacuchoLocation
    273Posts

    Re: Working Multilanguage (jorklenis2 fix)

    Quote Originally Posted by jetman82 View Post
    Havin a bit of trouble understanding what you're saying. It's not really adding much at all, it's only 1 extra function + 8-10 additional lines. PLus you get the benefit of not needing the xmls in the base container path like jord's requires, as well as allowing for many more languages to be easily added. Add 1 case + 1 define in zfilepath.cpp & you have your new languagepath :p

    Although you coud be completly right, there coudl be a much easier way of doing it, I'm sure there probably is, but this is the way i came up with 4 months ago, & if it works why bother going back & changing it. If it aint broke don't fix it :P
    good for me this would be a more tedious way since added more eh eh language and not have to go more aya what was already in the sources, I feel you do not understand me, I do not speak much English. Sorry.


  9. #9
    TBF Guru jetman82 is offline
    MemberRank
    Jan 2009 Join Date
    631Posts

    Re: Working Multilanguage (jorklenis2 fix)

    Quote Originally Posted by Arenbunny View Post
    good for me this would be a more tedious way since added more eh eh language and not have to go more aya what was already in the sources, I feel you do not understand me, I do not speak much English. Sorry.

    Well, guess your client didn't have the bug that caused all question marks, some people did some peopel didn't, if you did this would be one thing that fixes it :P

  10. #10
    Account Upgraded | Title Enabled! Arenbunny is offline
    MemberRank
    Mar 2013 Join Date
    Peru - AyacuchoLocation
    273Posts

    Re: Working Multilanguage (jorklenis2 fix)

    Quote Originally Posted by jetman82 View Post
    Well, guess your client didn't have the bug that caused all question marks, some people did some peopel didn't, if you did this would be one thing that fixes it :P
    the problem of interrogation is when there is no config.xml and create this does not create the appropriate language and so everything appears with question mark or also with the word "NOMSG" for that just had to fix some things such as this.

    is easier to do it this way than the way you are doing.



    - - - Updated - - -

    I think the problem is many programmers, who like most add things to figure out the whole source gunz and increase dual functions.

  11. #11
    TBF Guru jetman82 is offline
    MemberRank
    Jan 2009 Join Date
    631Posts

    Re: Working Multilanguage (jorklenis2 fix)

    Quote Originally Posted by Arenbunny View Post
    the problem of interrogation is when there is no config.xml and create this does not create the appropriate language and so everything appears with question mark or also with the word "NOMSG" for that just had to fix some things such as this.

    is easier to do it this way than the way you are doing.



    - - - Updated - - -

    I think the problem is many programmers, who like most add things to figure out the whole source gunz and increase dual functions.
    never really paid attention to what that was to be honest lmao, just ripped it out of the function & did my own thing :p
    Last edited by jetman82; 06-03-15 at 05:41 AM.

  12. #12
    Account Upgraded | Title Enabled! Arenbunny is offline
    MemberRank
    Mar 2013 Join Date
    Peru - AyacuchoLocation
    273Posts

    Re: Working Multilanguage (jorklenis2 fix)

    Quote Originally Posted by jetman82 View Post
    never really paid attention to what that was to be honest lmao, just ripped it out of the function & did my own thing :p
    when MAIET gave this solution to find the folder.

    string MLanguageCode::ConvCodeToStrLangType( const int nLangCode )
    {
    //if( LANGUAGE_CODE::KOR == nLangCode )
    //return string( "kor" );


    if( LANGUAGE_CODE::ENG == nLangCode )
    return string( "eng" );


    if( LANGUAGE_CODE::POR == nLangCode )
    return string( "por" );


    if( LANGUAGE_CODE::SPA == nLangCode )
    return string( "spa" );

    return string( 0 );
    }
    what you do to find the file.


    In ZFilePath.h, search for this:
    #define PATH_INTERFACE "Interface/"
    above it, add this:
    #define PATH_USA "system/USA/"
    #define PATH_SPA "system/SPA/"
    #define PATH_POR "system/POR/"

  13. #13
    Apprentice OsinLove is offline
    MemberRank
    Dec 2009 Join Date
    9Posts

    Re: Working Multilanguage (jorklenis2 fix)

    How to change ANSI to UTF-8 to use more Vietnamese

  14. #14
    TBF Guru jetman82 is offline
    MemberRank
    Jan 2009 Join Date
    631Posts

    Re: Working Multilanguage (jorklenis2 fix)

    Quote Originally Posted by Arenbunny View Post
    when MAIET gave this solution to find the folder.


    what you do to find the file.


    In ZFilePath.h, search for this:
    #define PATH_INTERFACE "Interface/"
    above it, add this:
    #define PATH_USA "system/USA/"
    #define PATH_SPA "system/SPA/"
    #define PATH_POR "system/POR/"
    Well, I never saw that b/c it doesn't exist in the 1.0 source lol. This was really intended as a 1.0 src fix that also works as a 1.5 fix. :p

    - - - Updated - - -

    Quote Originally Posted by OsinLove View Post
    How to change ANSI to UTF-8 to use more Vietnamese
    Unfortunately you have to rewrite the entire source to use more vietnamese, gunz wasn't built around unicode but mbcs. I started to do it but it just takes too damn long. You'll have to set your system locale to be vietnamese, for korean set it to korean, etc. Players that actually are from vietnam will be able to read it b/c they're already set for that.

  15. #15
    No One Knows ! ☠RockAngeL☠ is offline
    MemberRank
    Apr 2007 Join Date
    ☮/UAE.phpLocation
    3,185Posts

    Re: Working Multilanguage (jorklenis2 fix)

    If i include Arabic , it will work ?



Page 1 of 2 12 LastLast

Advertisement