getlocale...

IL-2 Modding help (not 3D modding):
Forum rules
IL-2 Modding help (not 3D and mapping help).
Post Reply
User avatar
PA_Yren
FM Modding Master
Posts: 414
Joined: Thu Sep 01, 2016 10:03 am

getlocale...

Post by PA_Yren » Wed Oct 10, 2018 2:12 pm

I've been investigating some things in code and come to a problem...

By defect, my IL2 seems is in english but if use:

RTSConf.cur.locale.getLanguage());
RTSConf.cur.locale.getCountry());

I got

getlanguage --> ru
getcountry --> RU



RTSConf is...

public RTSConf(MainWindow mainwindow)
{
/* 67*/ queue = new MessageQueue();
/* 69*/ queueNextTick = new MessageQueue();
/* 71*/ queueRealTime = new MessageQueue();
/* 73*/ queueRealTimeNextTick = new MessageQueue();
/* 78*/ cfgMap = new HashMapExt();
/* 80*/ backgroundLoop = new BackgroundLoop();
/* 89*/ profile = new RTSProfile();
/* 111*/ bRequestExitApp = false;
/* 114*/ bResetGame = false;
/* 134*/ bStarted = false;
/* 140*/ useMouse = 1;
/* 144*/ bUseJoy = true;
/* 148*/ bUseTrackIR = true;
/* 166*/ cur = this;
/* 167*/ locale = Locale.getDefault();
/* 168*/ time = new Time(30, 20);
/* 169*/ timer = new Timer(false, -1000);
/* 170*/ realTimer = new Timer(true, -1000);
/* 171*/ mainWindow = new MainWindow();
/* 172*/ keyboard = new Keyboard();
/* 173*/ mouse = new Mouse(null, null);
/* 174*/ joy = new Joy(null, null);
/* 175*/ trackIR = new TrackIR(null, null);
/* 176*/ netEnv = new NetEnv();
/* 177*/ cmdEnv = new CmdEnv();
/* 178*/ hotKeyCmdEnvs = new HotKeyCmdEnvs();
/* 179*/ hotKeyEnvs = new HotKeyEnvs();
/* 180*/ HotKeyCmdEnv.setCurrentEnv("default");
/* 181*/ console = new Console(0);
/* 182*/ setNetProperty();
}


Ups.... Where is controlled Country and language in IL2???
User avatar
dr strangelove
FM Modding Expert
Posts: 3479
Joined: Sun Dec 18, 2016 10:07 am

Re: getlocale...

Post by dr strangelove » Thu Oct 11, 2018 3:56 am

can this help ? ...

findstr /s /m /i language com\maddox *
(results are following files with all reference to language in com\maddox & all sub-directories)
maddox\il2\engine\Config.class
maddox\il2\engine\ConsoleGL0.class
maddox\il2\game\Main.class
maddox\il2\gui\GUIBWDemoPlay.class
maddox\il2\gui\GUICampaignNew.class
maddox\il2\gui\GUIDGenNew.class
maddox\il2\gui\GUINetServerNGenSelect.class
maddox\il2\gui\GUIQuick$byI18N_name.class
maddox\il2\gui\GUIRoot.class
maddox\il2\gui\GUITrainingPlay.class
maddox\il2\builder\PlMisAir.class
maddox\il2\builder\PlMisBrief.class
maddox\il2\builder\PlMisChief.class
maddox\il2\builder\PlMisHouse.class
maddox\il2\builder\PlMisStatic.class
maddox\il2\net\NetUser.class

findstr /s /m /i locale com\maddox *
(results are following files with all reference to locale in com\maddox & all sub-directories)
maddox\il2\engine\Config.class
maddox\il2\engine\ConsoleGL0.class
maddox\il2\engine\Land2DText.class
maddox\il2\ai\back\World.class
maddox\il2\ai\UserCfg.class
maddox\il2\ai\World.class
maddox\il2\builder\PlMisAir.class
maddox\il2\builder\PlMisBorn$24.class
maddox\il2\builder\PlMisBrief.class
maddox\il2\builder\PlMisChief.class
maddox\il2\builder\PlMisHouse.class
maddox\il2\builder\PlMisStatic.class
maddox\il2\builder\Zuti_WHomeBaseCountries$Table.class
maddox\il2\builder\Zuti_WManageAircrafts$6.class
maddox\il2\game\back\Mission.class
maddox\il2\game\HUD.class
maddox\il2\game\I18N$Res.class
maddox\il2\game\Main.class
maddox\il2\game\MainWin3D.class
maddox\il2\game\Mission$Mirror.class
maddox\il2\game\Mission$NetMissionObj.class
maddox\il2\game\Mission$SPAWN.class
maddox\il2\game\Mission$TimeOutWing.class
maddox\il2\game\Mission.class
maddox\il2\game\WConsole.class
maddox\il2\game\ZutiSupportMethods.class
maddox\il2\gui\GUIAirArming.class
maddox\il2\gui\GUIAwards.class
maddox\il2\gui\GUIBriefingGeneric.class
maddox\il2\gui\GUIBWDemoPlay.class
maddox\il2\gui\GUICampaignNew.class
maddox\il2\gui\GUICampaigns.class
maddox\il2\gui\GUICampaignStat.class
maddox\il2\gui\GUICampaignStatView.class
maddox\il2\gui\GUIControls.class
maddox\il2\gui\GUIDGenNew.class
maddox\il2\gui\GUIDGenRoster.class
maddox\il2\gui\GUINetClientCBrief.class
maddox\il2\gui\GUINetClientDBrief.class
maddox\il2\gui\GUINetServerMisSelect$FileMission.class
maddox\il2\gui\GUINetServerNGenProp.class
maddox\il2\gui\GUINetServerNGenSelect.class
maddox\il2\gui\GUIObjectInspector$ObjectInfo.class
maddox\il2\gui\GUIObjectInspector.class
maddox\il2\gui\GUIObjectView$ObjectInfo.class
maddox\il2\gui\GUIObjectView.class
maddox\il2\gui\GUIPad.class
maddox\il2\gui\GUIQuick$byI18N_name.class
maddox\il2\gui\GUIRoot.class
maddox\il2\gui\GUISetupInput.class
maddox\il2\gui\GUISetupMisc$DialogClient.class
maddox\il2\gui\GUISetupSound$DialogClient.class
maddox\il2\gui\GUISingleSelect$FileMission.class
maddox\il2\gui\GUISingleSelect.class
maddox\il2\gui\GUITrainingPlay.class
maddox\il2\gui\GUITrainingSelect.class
maddox\il2\net\BornPlace.class
maddox\il2\net\Chat.class
maddox\il2\net\NetUser.class
maddox\il2\objects\air\AircraftLH.class
maddox\il2\objects\air\B_24D140CO.class
maddox\il2\objects\weapons\Torpedo.class
maddox\rts\JoyDX.class
maddox\rts\MouseDX.class
maddox\rts\NetChannel.class
maddox\rts\ObjIO.class
maddox\rts\RTSConf.class
maddox\rts\VK.class

Found this in Config.java

Code: Select all

    private String getDefaultCountry() {
	String string = RTSConf.cur.locale.getLanguage();
	if ("ru".equalsIgnoreCase(string))
	    return "ru";
	if ("de".equalsIgnoreCase(string))
	    return "de";
	return "en";
    }
i think more than one place to set country values ...
?
perhaps look at old original sound mod by Wasy. The answer for relavent classes should be contained ?

also i18n folder ?

sorry Yren, perhaps not much help, just trying to give suggestions
i hope it can help you
User avatar
PA_Yren
FM Modding Master
Posts: 414
Joined: Thu Sep 01, 2016 10:03 am

Re: getlocale...

Post by PA_Yren » Thu Oct 11, 2018 10:46 am

I've found where setlocale is set...

Main.class

Code: Select all


 public static void exec(Main main, String s, String s1, int i)
            {
/* 369*/        IniFile inifile = new IniFile(s, 0);
/* 370*/        String s2 = inifile.get("rts", "locale", "us");
/* 371*/        Locale.setDefault(Locale.US);
/* 373*/        try
                {
/* 373*/            s2 = s2.toLowerCase();
/* 374*/            if(s2.length() == 2)
/* 375*/                Locale.setDefault(new Locale(s2, ""));
                }
/* 376*/        catch(Exception exception) { }
/* 378*/        if(Config.LOCALE.equals("RU"))
                {
/* 379*/            Locale.setDefault(new Locale("ru", "RU"));
/* 382*/            try
                    {
/* 382*/                Cpu86ID.getMask();
                    }
/* 383*/            catch(Throwable throwable) { }
                } else
/* 385*/        if(Config.LOCALE.equals("JP"))
                {
/* 386*/            Locale.setDefault(new Locale("ja", "JP"));
                } else
                {
/* 389*/            String s3 = Locale.getDefault().getLanguage();
/* 390*/            if(!"de".equals(s3) && !"fr".equals(s3) && !"cs".equals(s3) && !"pl".equals(s3) && !"hu".equals(s3) && !"lt".equals(s3) && !"us".equals(s3))
/* 397*/                Locale.setDefault(Locale.US);
                }
/* 400*/        if("ru".equals(Locale.getDefault().getLanguage()))
/* 401*/            RTSConf.charEncoding = "Cp1251";
/* 402*/        else
/* 402*/        if("cs".equals(Locale.getDefault().getLanguage()))
/* 403*/            RTSConf.charEncoding = "Cp1250";
/* 404*/        else
/* 404*/        if("pl".equals(Locale.getDefault().getLanguage()))
/* 405*/            RTSConf.charEncoding = "Cp1250";
/* 406*/        else
/* 406*/        if("hu".equals(Locale.getDefault().getLanguage()))
/* 407*/            RTSConf.charEncoding = "Cp1250";
/* 408*/        else
/* 408*/        if("lt".equals(Locale.getDefault().getLanguage()))
/* 409*/            RTSConf.charEncoding = "Cp1257";
/* 410*/        else
/* 410*/        if("ja".equals(Locale.getDefault().getLanguage()))
/* 411*/            RTSConf.charEncoding = "SJIS";
/* 414*/        if(cur != null)
/* 415*/            throw new RuntimeException("Traying recurse execute main method");
/* 417*/        Runtime.getRuntime().traceInstructions(false);
/* 418*/        Runtime.getRuntime().traceMethodCalls(false);
/* 419*/        cur = main;
/* 420*/        if(!main.isLifeLimitted())
                {
/* 422*/            try
                    {
/* 422*/                if(main.beginApp(s, s1, i))
                        {
/* 423*/                    clearCache();
/* 426*/                    if(Config.LOCALE.equals("RU"))
/* 428*/                        try
                                {
/* 428*/                            Cpu86ID.getMask();
                                }
/* 430*/                        catch(Throwable throwable1)
                                {
/* 430*/                            for(int j = 0; j < 10; j++)
/* 431*/                                new MsgAction(64, 1.0D + (double)(j * 10) + Math.random() * 10D) {

                                            public void doAction()
                                            {
/* 432*/                                        Main.doGameExit();
                                            }

                                }
;

.....

User avatar
dr strangelove
FM Modding Expert
Posts: 3479
Joined: Sun Dec 18, 2016 10:07 am

Re: getlocale...

Post by dr strangelove » Fri Oct 12, 2018 9:24 am

I hope the searches I provided helped you find the class file

Using command line...
findstr /s /m /i language com\maddox *
& or
findstr /s /m /i locale com\maddox *

findstr is a powerful & quick way to help you find key words (strings) you are looking for within a file or multiple files
In this case both language & locale were in both searches , this can give a good indication. Remember all those tools we downloaded which helped you find words in files? Well you never needed them.

I'm not exactly sure why Microsoft does not make this tool so easy to know or understand other than the obvious.
https://stackoverflow.com/questions/884 ... str-comman


I hope it helps in future
User avatar
PA_Yren
FM Modding Master
Posts: 414
Joined: Thu Sep 01, 2016 10:03 am

Re: getlocale...

Post by PA_Yren » Mon Oct 15, 2018 8:56 am

Now my problem is with Main.class compilation... Every time I try to compile in Eclipse, my game get stuck at 30% (loading stationary ini file ????) even w/o any modification to file...
User avatar
dr strangelove
FM Modding Expert
Posts: 3479
Joined: Sun Dec 18, 2016 10:07 am

Re: getlocale...

Post by dr strangelove » Mon Oct 15, 2018 10:53 am

Hi Yren, this is common mate, I can help you with this, it was a problem for me for some time.
Anyway I have a main.java which compiles, and works 100% I'll get it to you
If you look at my cockpit indicators mod, that has a working main.class. Try that first, I'll send you the source code too

Please try Main.class from this mod first (4134)
viewtopic.php?f=16&t=1833

Decompile, recompile, if it doesn't work still, I can upload you source.

Edit:
I am not certain but this may have been something ton helped me with ? I really can not remember ?but one time I asked him for some Java help, I think it was with the Main.java. If you're out there reading this ton, I don't think I would have working Main.java without you ! After he did this, he became a Java Jedi in my world ;)



Hey Yren

Ignore what i wrote before ...That was for main3d.java , sorry !

But I can still help you with working with Main.java

Main.java
Decompiler with 4.13.4 classes > http://www.mediafire.com/file/a3axy49a5 ... mpiler.rar
I use this to compile > viewtopic.php?f=44&t=1506

Sent you PM with my Main.java
Last edited by dr strangelove on Mon Oct 15, 2018 11:41 am, edited 1 time in total.
User avatar
dr strangelove
FM Modding Expert
Posts: 3479
Joined: Sun Dec 18, 2016 10:07 am

Re: getlocale...

Post by dr strangelove » Mon Oct 15, 2018 8:49 pm

~

I hope im not going off topic here but i really think this will help you with future with java investigations + i did not want to put into tools section


This will search for any key words & or multiple key words within folders, in this case for com\Maddox
https://archive.org/download/SEARCHCOMF ... FOLDER.rar
Please read the Readme contained
User avatar
PA_Yren
FM Modding Master
Posts: 414
Joined: Thu Sep 01, 2016 10:03 am

Re: getlocale...

Post by PA_Yren » Tue Oct 16, 2018 8:28 am

will try. thanks.
Post Reply

Return to “Modding Help (not 3D)”

Who is online

Users browsing this forum: No registered users and 15 guests