diff options
-rw-r--r-- | src/base/UIni.pas | 49 | ||||
-rw-r--r-- | src/screens/UScreenOptionsGame.pas | 2 |
2 files changed, 44 insertions, 7 deletions
diff --git a/src/base/UIni.pas b/src/base/UIni.pas index 2bcc7305..8cf01081 100644 --- a/src/base/UIni.pas +++ b/src/base/UIni.pas @@ -36,8 +36,8 @@ interface uses Classes, IniFiles, - ULog, - SysUtils; + SysUtils, + ULog; type // TInputDeviceConfig stores the configuration for an input device. @@ -254,6 +254,8 @@ const IMicBoost: array[0..3] of string = ('Off', '+6dB', '+12dB', '+18dB'); var + ILanguageTranslated: array of string; + IDifficultyTranslated: array[0..2] of string = ('Easy', 'Medium', 'Hard'); ITabsTranslated: array[0..1] of string = ('Off', 'On'); @@ -316,22 +318,57 @@ implementation uses StrUtils, - UMain, SDL, + UCommandLine, ULanguage, UPlatform, - USkins, + UMain, + UPath, URecord, - UCommandLine, - UPath; + USkins; (** * Translate and set the values of options, which need translation. *) procedure TIni.TranslateOptionValues; +const + NumberOfLanguages = 14; +var + ErrorStringStart: string; begin ULanguage.Language.ChangeLanguage(ILanguage[Language]); + + ErrorStringStart := 'The number of language files (' + + IntToStr(Length(ILanguage)) + ') is '; + + if Length(ILanguage) > NumberOfLanguages then + begin + Log.LogError(ErrorStringStart + 'larger than expected (' + IntToStr(NumberOfLanguages) + ').', + 'Ini.TranslateOptionValues'); + Halt; + 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'); IDifficultyTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_HARD'); diff --git a/src/screens/UScreenOptionsGame.pas b/src/screens/UScreenOptionsGame.pas index 1d741d25..0c152c41 100644 --- a/src/screens/UScreenOptionsGame.pas +++ b/src/screens/UScreenOptionsGame.pas @@ -137,7 +137,7 @@ begin Theme.OptionsGame.SelectLanguage.showArrows := true; Theme.OptionsGame.SelectLanguage.oneItemOnly := true; - AddSelectSlide(Theme.OptionsGame.SelectLanguage, Ini.Language, ILanguage); + AddSelectSlide(Theme.OptionsGame.SelectLanguage, Ini.Language, ILanguageTranslated); Theme.OptionsGame.SelectTabs.showArrows := true; Theme.OptionsGame.SelectTabs.oneItemOnly := true; |