diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-07-26 13:08:47 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-07-26 13:08:47 +0000 |
commit | c2139f0a4ab0e86f9632881f4954b7e3b41e10d5 (patch) | |
tree | db96e58aef7b4b36c39c90b54144c6308428d813 /src/base/UIni.pas | |
parent | 384aa7c5adbaec638277e9caf0840dad77540b58 (diff) | |
download | usdx-c2139f0a4ab0e86f9632881f4954b7e3b41e10d5.tar.gz usdx-c2139f0a4ab0e86f9632881f4954b7e3b41e10d5.tar.xz usdx-c2139f0a4ab0e86f9632881f4954b7e3b41e10d5.zip |
Language option fix:
- Never assume an order of the files returned by FindFirst/Next(). This will not work on linux as the order is random.
- That is also the reason why the default theme on linux is random (usdx uses the first theme returned by FindFirst(). This is not fixed yet.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1923 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/base/UIni.pas')
-rw-r--r-- | src/base/UIni.pas | 44 |
1 files changed, 11 insertions, 33 deletions
diff --git a/src/base/UIni.pas b/src/base/UIni.pas index fb200f3c..f92ea7c3 100644 --- a/src/base/UIni.pas +++ b/src/base/UIni.pas @@ -331,43 +331,22 @@ uses * Translate and set the values of options, which need translation. *) procedure TIni.TranslateOptionValues; -const - NumberOfLanguages = 14; var - ErrorStringStart: string; + I: integer; begin - ULanguage.Language.ChangeLanguage(ILanguage[Language]); - - ErrorStringStart := 'The number of language files (' - + IntToStr(Length(ILanguage)) + ') is '; + // Load Languagefile + if (Params.Language <> -1) then + ULanguage.Language.ChangeLanguage(ILanguage[Params.Language]) + else + ULanguage.Language.ChangeLanguage(ILanguage[Ini.Language]); - if Length(ILanguage) > NumberOfLanguages then + SetLength(ILanguageTranslated, Length(ILanguage)); + for I := 0 to High(ILanguage) do begin - Log.LogError(ErrorStringStart + 'larger than expected (' + IntToStr(NumberOfLanguages) + ').', - 'Ini.TranslateOptionValues'); - Halt; + ILanguageTranslated[I] := ULanguage.Language.Translate( + 'OPTION_VALUE_' + UpperCase(ILanguage[I]) + ); end; - - if Length(ILanguage) < NumberOfLanguages then - Log.LogWarn(ErrorStringStart + 'smaller than expected (' + IntToStr(NumberOfLanguages) + ').', - 'Ini.TranslateOptionValues'); - - SetLength(ILanguageTranslated, NumberOfLanguages); - - ILanguageTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_CATALAN'); - ILanguageTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_CROATIAN'); - ILanguageTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_DUTCH'); - ILanguageTranslated[3] := ULanguage.Language.Translate('OPTION_VALUE_ENGLISH'); - ILanguageTranslated[4] := ULanguage.Language.Translate('OPTION_VALUE_EUSKARA'); - ILanguageTranslated[5] := ULanguage.Language.Translate('OPTION_VALUE_FINNISH'); - ILanguageTranslated[6] := ULanguage.Language.Translate('OPTION_VALUE_FRENCH'); - ILanguageTranslated[7] := ULanguage.Language.Translate('OPTION_VALUE_GERMAN'); - ILanguageTranslated[8] := ULanguage.Language.Translate('OPTION_VALUE_GREEK'); - ILanguageTranslated[9] := ULanguage.Language.Translate('OPTION_VALUE_ITALIAN'); - ILanguageTranslated[10] := ULanguage.Language.Translate('OPTION_VALUE_JAPANESE'); - ILanguageTranslated[11] := ULanguage.Language.Translate('OPTION_VALUE_PORTUGUESE'); - ILanguageTranslated[12] := ULanguage.Language.Translate('OPTION_VALUE_SPANISH'); - ILanguageTranslated[13] := ULanguage.Language.Translate('OPTION_VALUE_SWEDISH'); IDifficultyTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_EASY'); IDifficultyTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_MEDIUM'); @@ -941,7 +920,6 @@ begin // Language Language := GetArrayIndex(ILanguage, IniFile.ReadString('Game', 'Language', 'English')); - //Language.ChangeLanguage(ILanguage[Language]); // Tabs Tabs := GetArrayIndex(ITabs, IniFile.ReadString('Game', 'Tabs', ITabs[0])); |