aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/base/UIni.pas44
-rw-r--r--src/base/ULanguage.pas34
-rw-r--r--src/base/UMain.pas6
3 files changed, 28 insertions, 56 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]));
diff --git a/src/base/ULanguage.pas b/src/base/ULanguage.pas
index c2b44ffa..80926774 100644
--- a/src/base/ULanguage.pas
+++ b/src/base/ULanguage.pas
@@ -46,9 +46,9 @@ type
TLanguage = class
public
- Entry: array of TLanguageEntry; //Entrys of Chosen Language
- SEntry: array of TLanguageEntry; //Entrys of Standard Language
- CEntry: array of TLanguageEntry; //Constant Entrys e.g. Version
+ Entry: array of TLanguageEntry; //Entrys of Chosen Language
+ EntryDefault: array of TLanguageEntry; //Entrys of Standard Language
+ EntryConst: array of TLanguageEntry; //Constant Entrys e.g. Version
Implode_Glue1, Implode_Glue2: String;
public
List: array of TLanguageList;
@@ -107,9 +107,9 @@ begin
begin
ChangeLanguage('English');
- SetLength(SEntry, Length(Entry));
+ SetLength(EntryDefault, Length(Entry));
for J := low(Entry) to high(Entry) do
- SEntry[J] := Entry[J];
+ EntryDefault[J] := Entry[J];
SetLength(Entry, 0);
@@ -189,10 +189,10 @@ begin
Text := Uppercase(Result);
//Const Mod
- for E := 0 to high(CEntry) do
- if Text = CEntry[E].ID then
+ for E := 0 to high(EntryConst) do
+ if Text = EntryConst[E].ID then
begin
- Result := CEntry[E].Text;
+ Result := EntryConst[E].Text;
exit;
end;
//Const Mod End
@@ -206,10 +206,10 @@ begin
//Standard Language (If a Language File is Incomplete)
//Then use Standard Language
- for E := low(SEntry) to high(SEntry) do
- if Text = SEntry[E].ID then
+ for E := low(EntryDefault) to high(EntryDefault) do
+ if Text = EntryDefault[E].ID then
begin
- Result := SEntry[E].Text;
+ Result := EntryDefault[E].Text;
Break;
end;
//Standard Language END
@@ -220,9 +220,9 @@ end;
//----------
procedure TLanguage.AddConst (ID, Text: String);
begin
- SetLength (CEntry, Length(CEntry) + 1);
- CEntry[high(CEntry)].ID := ID;
- CEntry[high(CEntry)].Text := Text;
+ SetLength (EntryConst, Length(EntryConst) + 1);
+ EntryConst[high(EntryConst)].ID := ID;
+ EntryConst[high(EntryConst)].Text := Text;
end;
//----------
@@ -232,11 +232,11 @@ procedure TLanguage.ChangeConst(ID, Text: String);
var
I: Integer;
begin
- for I := 0 to high(CEntry) do
+ for I := 0 to high(EntryConst) do
begin
- if CEntry[I].ID = ID then
+ if EntryConst[I].ID = ID then
begin
- CEntry[I].Text := Text;
+ EntryConst[I].Text := Text;
Break;
end;
end;
diff --git a/src/base/UMain.pas b/src/base/UMain.pas
index 187318a6..33eca888 100644
--- a/src/base/UMain.pas
+++ b/src/base/UMain.pas
@@ -174,12 +174,6 @@ begin
Log.LogStatus('Write Ini', 'Initialization');
Ini.Save;
- // Load Languagefile
- if (Params.Language <> -1) then
- Language.ChangeLanguage(ILanguage[Params.Language])
- else
- Language.ChangeLanguage(ILanguage[Ini.Language]);
-
Log.BenchmarkEnd(1);
Log.LogBenchmark('Loading Ini', 1);