add language selection page in installer

This commit is contained in:
Wengier
2021-07-19 23:13:55 -04:00
parent 2d51be6404
commit 45a1ba13b4
2 changed files with 71 additions and 5 deletions

View File

@@ -4,7 +4,8 @@
for WinXP+ (all) and Vista+ 64-bit respectively,
reducing the sizes of installers significantly
while adding the SarasaGothicFixed TTF font and
existing language translations. (Wengier)
a language selection page for choosing existing
language translations. (Wengier)
- DOSBox-X will now search for more paths (such as
user config directory and "languages" subfolder)
for loading language files before fail. (Wengier)

View File

@@ -1,4 +1,4 @@
#define MyAppName "DOSBox-X"
#define MyAppName "DOSBox-X"
#define MyAppVersion "0.83.16"
#define MyAppBit "(32-bit)"
#define MyAppPublisher "joncampbell123 [DOSBox-X Team]"
@@ -174,7 +174,7 @@ var
msg: string;
build64: Boolean;
HelpButton: TNewButton;
PageBuild, PageOutput, PageVer: TInputOptionWizardPage;
PageBuild, PageLang, PageOutput, PageVer: TInputOptionWizardPage;
function IsVerySilent(): Boolean;
var
k: Integer;
@@ -251,8 +251,16 @@ begin
PageOutput.Add('OpenGL with pixel-perfect scaling');
PageOutput.Add('TrueType font (TTF) / Direct3D output');
PageOutput.Values[2] := True;
msg:='DOSBox-X supports language files to display messages in different languages.' #13#13 'By default the user interface is English, but you may want to select a different language for its user interface.' #13#13 'This setting can be later modified in the DOSBox-X''s configuration file (dosbox-x.conf).';
PageLang:=CreateInputOptionPage(101, 'User interface language', 'Select the language for DOSBox-X''s user interface', msg, True, False);
PageLang.Add('Default (English)');
PageLang.Add('Japanese (日本語)');
PageLang.Add('Simplified Chinese (简体中文)');
PageLang.Add('Spanish (Español)');
PageLang.Add('Traditional Chinese (繁體/正體中文)');
PageLang.Values[0] := True;
msg:='You can specify a default DOS version for DOSBox-X to report to itself and DOS programs. This can sometimes change the feature sets of DOSBox-X. For example, selecting 7.10 as the reported DOS version will enable support for Windows-style long filenames (LFN) and FAT32 disk images (>2GB disk images) by default.' #13#13 'If you are not sure about which DOS version to report, you can also leave this unselected, then a preset DOS version will be reported (usually 5.00).' #13#13 'This setting can be later modified in the DOSBox-X''s configuration file (dosbox-x.conf).';
PageVer:=CreateInputOptionPage(101, 'Reported DOS version', 'Specify the default DOS version to report', msg, True, False);
PageVer:=CreateInputOptionPage(102, 'Reported DOS version', 'Specify the default DOS version to report', msg, True, False);
PageVer.Add('DOS version 3.30');
PageVer.Add('DOS version 5.00 (reported by default)');
PageVer.Add('DOS version 6.22');
@@ -260,7 +268,7 @@ begin
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := ((PageID = 101) or (PageID = 102)) and FileExists(ExpandConstant('{app}\dosbox-x.conf'));
Result := ((PageID = 101) or (PageID = 102) or (PageID = 103)) and FileExists(ExpandConstant('{app}\dosbox-x.conf')) or ((PageID = 102) and not PageOutput.Values[2]);
end;
procedure CurPageChanged(CurPageID: Integer);
begin
@@ -319,6 +327,21 @@ begin
msg:='TrueType font (TTF) / Direct3D output';
Wizardform.ReadyMemo.Lines.Add(' '+msg);
end;
if PageLang.Values[0] or PageLang.Values[1] or PageLang.Values[2] or PageLang.Values[3] or PageLang.Values[4] then
begin
Wizardform.ReadyMemo.Lines.Add('');
Wizardform.ReadyMemo.Lines.Add('User interface language:');
msg:='Default (English)';
if (PageLang.Values[1]) then
msg:='Japanese (日本語)';
if (PageLang.Values[2]) then
msg:='Simplified Chinese (简体中文)';
if (PageLang.Values[3]) then
msg:='Spanish (Español)';
if (PageLang.Values[4]) then
msg:='Traditional Chinese (繁體/正體中文)';
Wizardform.ReadyMemo.Lines.Add(' '+msg);
end;
if PageVer.Values[0] or PageVer.Values[1] or PageVer.Values[2] or PageVer.Values[3] then
begin
Wizardform.ReadyMemo.Lines.Add('');
@@ -416,6 +439,48 @@ begin
end;
FileLines.SaveToFile(ExpandConstant('{app}\dosbox-x.conf'));
end;
if FileExists(ExpandConstant('{app}\dosbox-x.conf')) and (PageLang.Values[1] or PageLang.Values[2] or PageLang.Values[3] or PageLang.Values[4]) then
begin
FileLines := TStringList.Create;
FileLines.LoadFromFile(ExpandConstant('{app}\dosbox-x.conf'));
section := '';
for i := 0 to FileLines.Count - 1 do
begin
line := Trim(FileLines[i]);
if (Length(line)>2) and (Copy(line, 1, 1) = '[') and (Copy(line, Length(line), 1) = ']') then
section := Copy(line, 2, Length(line)-2);
if (Length(line)>0) and (Copy(line, 1, 1) <> '#') and (Copy(line, 1, 1) <> '[') and (Pos('=', line) > 1) then
begin
linetmp := Trim(Copy(line, 1, Pos('=', line) - 1));
if (CompareText(linetmp, 'language') = 0) and (CompareText(section, 'dosbox') = 0) then
begin
linetmp := Trim(Copy(line, 1, Pos('=', line)));
if (PageLang.Values[1]) and FileExists(ExpandConstant('{app}\languages\ja_JP.lng')) then
FileLines[i] := linetmp+' ja_JP';
if (PageLang.Values[2]) and FileExists(ExpandConstant('{app}\languages\zh_CN.lng')) then
FileLines[i] := linetmp+' zh_CN';
if (PageLang.Values[3]) and FileExists(ExpandConstant('{app}\languages\es_ES.lng')) then
FileLines[i] := linetmp+' es_ES';
if (PageLang.Values[4]) and FileExists(ExpandConstant('{app}\languages\zh_TW.lng')) then
FileLines[i] := linetmp+' zh_TW';
end;
if (CompareText(linetmp, 'country') = 0) and (CompareText(section, 'config') = 0) then
begin
linetmp := Trim(Copy(line, 1, Pos('=', line)));
if (PageLang.Values[1]) then
FileLines[i] := linetmp+' 81,932';
if (PageLang.Values[2]) then
FileLines[i] := linetmp+' 86,936';
if (PageLang.Values[3]) then
FileLines[i] := linetmp+' 34,858';
if (PageLang.Values[4]) then
FileLines[i] := linetmp+' 886,950';
break;
end
end
end;
FileLines.SaveToFile(ExpandConstant('{app}\dosbox-x.conf'));
end;
if FileExists(ExpandConstant('{app}\dosbox-x.conf')) and (PageVer.Values[0] or PageVer.Values[1] or PageVer.Values[2] or PageVer.Values[3]) then
begin
FileLines := TStringList.Create;