# HG changeset patch # User koda # Date 1302042602 -7200 # Node ID d8856d98ce7d11aa7a82bd7b1a43db729ed5c530 # Parent 6d2e8a24277e3590aa695401beff2d633cae1d50# Parent d48230ef9447d85956abe3daaac45ac17711a0f0 merge diff -r 6d2e8a24277e -r d8856d98ce7d hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Wed Apr 06 00:29:49 2011 +0200 +++ b/hedgewars/hwengine.pas Wed Apr 06 00:30:02 2011 +0200 @@ -260,13 +260,16 @@ InitKbdKeyTable(); LoadLocale(Pathz[ptLocale] + '/en.txt'); // Do an initial load with english + if (Length(cLocaleFName) > 6) then cLocale := Copy(cLocaleFName,1,5) + else cLocale := Copy(cLocaleFName,1,2); if cLocaleFName <> 'en.txt' then begin // Try two letter locale first before trying specific locale overrides - if (Length(cLocaleFName) > 6) and (Copy(cLocaleFName,1,2)+'.txt' <> 'en.txt') then - LoadLocale(Pathz[ptLocale] + '/' + Copy(cLocaleFName,1,2)+'.txt'); + if (Length(cLocale) > 2) and (Copy(cLocale,1,2) <> 'en') then + LoadLocale(Pathz[ptLocale] + '/' + Copy(cLocale,1,2)+'.txt'); LoadLocale(Pathz[ptLocale] + '/' + cLocaleFName); - end; + end + else cLocale := 'en'; WriteLnToConsole(msgGettingConfig); diff -r 6d2e8a24277e -r d8856d98ce7d hedgewars/uSound.pas --- a/hedgewars/uSound.pas Wed Apr 06 00:29:49 2011 +0200 +++ b/hedgewars/uSound.pas Wed Apr 06 00:30:02 2011 +0200 @@ -20,7 +20,7 @@ unit uSound; interface -uses SDLh, uConsts, uTypes; +uses SDLh, uConsts, uTypes, sysutils; var MusicFN: shortstring; @@ -61,13 +61,29 @@ function AskForVoicepack(name: shortstring): Pointer; var i: Longword; + locName, path: shortstring; begin i:= 0; + // First, attempt to locate a localised version of the voice + if cLocale <> 'en' then + begin + locName:= name+'_'+cLocale; + path:= Pathz[ptVoices] + '/' + locName; + if DirectoryExists(path) then name:= locName + else if Length(cLocale) > 2 then + begin + locName:= name+'_'+Copy(cLocale,1,2); + path:= Pathz[ptVoices] + '/' + locName; + if DirectoryExists(path) then name:= locName + end + end; + + // If that fails, use the unmodified one while (voicepacks[i].name <> name) and (voicepacks[i].name <> '') do - begin + begin inc(i); TryDo(i <= cMaxTeams, 'Engine bug: AskForVoicepack i > cMaxTeams', true) - end; + end; voicepacks[i].name:= name; AskForVoicepack:= @voicepacks[i] diff -r 6d2e8a24277e -r d8856d98ce7d hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Wed Apr 06 00:29:49 2011 +0200 +++ b/hedgewars/uVariables.pas Wed Apr 06 00:30:02 2011 +0200 @@ -33,6 +33,7 @@ isSoundEnabled : boolean = true; isMusicEnabled : boolean = false; cLocaleFName : shortstring = 'en.txt'; + cLocale : shortstring = 'en'; cInitVolume : LongInt = 100; cTimerInterval : LongInt = 8; PathPrefix : shortstring = './';