Adopt Fluent in DiscoHawk, simply moving strings across

This commit is contained in:
YoshiRulz 2025-07-28 00:45:11 +10:00
parent ac27453478
commit b14f0333b5
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
5 changed files with 150 additions and 47 deletions

View File

@ -7,7 +7,7 @@ namespace BizHawk.Client.DiscoHawk
{
public class About : Form
{
public About()
public About(MultiMessageContext i18n)
{
SuspendLayout();
@ -17,12 +17,7 @@ namespace BizHawk.Client.DiscoHawk
richTextBox1.ReadOnly = true;
richTextBox1.Size = new(499, 236);
richTextBox1.TabIndex = 1;
richTextBox1.Text = ("DiscoHawk converts bolloxed-up crusty disc images to totally tidy CCD."
+ "\n\nDiscoHawk is part of the BizHawk project ( https://github.com/TASEmulators/BizHawk )."
+ "\n\nBizHawk is a .net-based multi-system emulator brought to you by some of the rerecording emulator principals. We wrote our own cue parsing/generating code to be able to handle any kind of junk we threw at it. Instead of trapping it in the emulator, we liberated it in the form of this tool, to be useful in other environments."
+ "\n\nTo use, drag a disc (.cue, .iso, .ccd, .cdi, .mds, .nrg) into the top area. DiscoHawk will dump a newly cleaned up CCD file set to the same directory as the original disc image, and call it _hawked."
+ "\n\nThis is beta software. You are invited to report problems to our bug tracker or IRC. Problems consist of: crusty disc images that crash DiscoHawk or that cause DiscoHawk to produce a _hawked.ccd which fails to serve your particular purposes (which we will need to be informed of, in case we are outputting wrongly.)")
.Replace("\n", Environment.NewLine);
richTextBox1.Text = i18n["discohawkabout-4584-lbl-explainer-label"]!.Replace("\n", Environment.NewLine);
richTextBox1.LinkClicked += (_, clickedArgs) => Util.OpenUrlExternal(clickedArgs.LinkText);
Button button1 = new();
@ -31,7 +26,7 @@ namespace BizHawk.Client.DiscoHawk
button1.Name = "button1";
button1.Size = new(75, 23);
button1.TabIndex = 2;
button1.Text = "OK";
button1.Text = i18n["discohawkabout-9804-btn-dismiss-textstr"];
button1.UseVisualStyleBackColor = true;
button1.Click += (_, _) => Close();
@ -55,7 +50,7 @@ namespace BizHawk.Client.DiscoHawk
FormBorderStyle = FormBorderStyle.FixedDialog;
MinimizeBox = false;
Name = "About";
Text = "About DiscoHawk";
Text = i18n["discohawkabout-2822-windowtitlestatic"];
ResumeLayout(performLayout: false);
PerformLayout();
}

View File

@ -7,7 +7,7 @@ namespace BizHawk.Client.DiscoHawk
{
public readonly RichTextBox textBox1;
public ComparisonResults()
public ComparisonResults(MultiMessageContext i18n)
{
SuspendLayout();
@ -19,7 +19,7 @@ namespace BizHawk.Client.DiscoHawk
textBox1.ReadOnly = true;
textBox1.Size = new(757, 394);
textBox1.TabIndex = 1;
textBox1.Text = "";
textBox1.Text = string.Empty; // overwritten by caller as part of object initialisation
TabControl tabControl1 = new();
tabControl1.SuspendLayout();
@ -43,7 +43,7 @@ namespace BizHawk.Client.DiscoHawk
tabPage1.Padding = new(all: 3);
tabPage1.Size = new(763, 400);
tabPage1.TabIndex = 0;
tabPage1.Text = "Log";
tabPage1.Text = i18n["discohawkcomparereadout-6110-tab-log-textstr"];
tabPage1.UseVisualStyleBackColor = true;
tabPage2.Location = new(4, 22);
@ -51,7 +51,7 @@ namespace BizHawk.Client.DiscoHawk
tabPage2.Padding = new(all: 3);
tabPage2.Size = new(763, 400);
tabPage2.TabIndex = 1;
tabPage2.Text = "SRC Context";
tabPage2.Text = i18n["discohawkcomparereadout-6110-tab-src-textstr"];
tabPage2.UseVisualStyleBackColor = true;
tabPage3.Location = new(4, 22);
@ -59,7 +59,7 @@ namespace BizHawk.Client.DiscoHawk
tabPage3.Padding = new(all: 3);
tabPage3.Size = new(763, 400);
tabPage3.TabIndex = 2;
tabPage3.Text = "DST Context";
tabPage3.Text = i18n["discohawkcomparereadout-6110-tab-dest-textstr"];
tabPage3.UseVisualStyleBackColor = true;
AutoScaleDimensions = new(6.0f, 13.0f);
@ -67,7 +67,7 @@ namespace BizHawk.Client.DiscoHawk
ClientSize = new(771, 426);
Controls.Add(tabControl1);
Name = "ComparisonResults";
Text = "ComparisonResults";
Text = i18n["discohawkcomparereadout-2005-windowtitlestatic"];
tabControl1.ResumeLayout(performLayout: false);
tabPage1.ResumeLayout(performLayout: false);
ResumeLayout(performLayout: false);

View File

@ -11,6 +11,8 @@ namespace BizHawk.Client.DiscoHawk
{
public class MainDiscoForm : Form
{
private readonly MultiMessageContext _i18n;
private readonly RadioButton ccdOutputButton;
private readonly RadioButton chdOutputButton;
@ -26,8 +28,10 @@ namespace BizHawk.Client.DiscoHawk
// An outputted list showing new file name
// Progress bar should show file being converted
// Add disc button, which puts it on the progress cue (converts it)
public MainDiscoForm()
public MainDiscoForm(MultiMessageContext i18n)
{
_i18n = i18n;
SuspendLayout();
Button ExitButton = new();
@ -35,7 +39,7 @@ namespace BizHawk.Client.DiscoHawk
ExitButton.Name = "ExitButton";
ExitButton.Size = new(75, 23);
ExitButton.TabIndex = 0;
ExitButton.Text = "E&xit";
ExitButton.Text = i18n["maindiscoform-4723-btn-exit-textstr"];
ExitButton.UseVisualStyleBackColor = true;
ExitButton.Click += (_, _) => Close();
@ -56,7 +60,7 @@ namespace BizHawk.Client.DiscoHawk
label1.Name = "label1";
label1.Size = new(166, 47);
label1.TabIndex = 0;
label1.Text = "Drag here to HAWK your disc - dump it out as a clean CCD/CHD";
label1.Text = i18n["maindiscoform-1872-area-hawkdisc-label"];
lblMp3ExtractMagicArea = new();
lblMp3ExtractMagicArea.SuspendLayout();
@ -75,16 +79,16 @@ namespace BizHawk.Client.DiscoHawk
label2.Name = "label2";
label2.Size = new(163, 39);
label2.TabIndex = 0;
label2.Text = "Drag a disc here to extract the audio tracks to MP3";
label2.Text = i18n["maindiscoform-6011-area-mp3extract-label"];
Button btnAbout = new();
btnAbout.Location = new(353, 414);
btnAbout.Name = "btnAbout";
btnAbout.Size = new(75, 23);
btnAbout.TabIndex = 3;
btnAbout.Text = "&About";
btnAbout.Text = i18n["maindiscoform-5766-btn-about-textstr"];
btnAbout.UseVisualStyleBackColor = true;
btnAbout.Click += (_, _) => new About().ShowDialog();
btnAbout.Click += (_, _) => new About(_i18n).ShowDialog();
RadioButton radioButton1 = new();
radioButton1.AutoSize = true;
@ -94,7 +98,7 @@ namespace BizHawk.Client.DiscoHawk
radioButton1.Size = new(67, 17);
radioButton1.TabIndex = 4;
radioButton1.TabStop = true;
radioButton1.Text = "BizHawk";
radioButton1.Text = i18n["maindiscoform-4559-radio-engine-hawk-textstr"];
radioButton1.UseVisualStyleBackColor = true;
GroupBox groupBox1 = new();
@ -112,19 +116,19 @@ namespace BizHawk.Client.DiscoHawk
groupBox1.Size = new(276, 234);
groupBox1.TabIndex = 5;
groupBox1.TabStop = false;
groupBox1.Text = "Disc Reading Engine";
groupBox1.Text = i18n["maindiscoform-7187-group-engine-label"];
label4.Location = new(20, 95);
label4.Name = "label4";
label4.Size = new(216, 43);
label4.TabIndex = 8;
label4.Text = "- Doesn\'t support audio decoding yet\r\n(even though Mednafen proper can do it)\r\n- Loads ISO, CUE, and CCD";
label4.Text = i18n["maindiscoform-7205-radio-engine-mednafen-longdesc-label"];
label3.Location = new(20, 39);
label3.Name = "label3";
label3.Size = new(253, 33);
label3.TabIndex = 7;
label3.Text = "- Uses FFMPEG for audio decoding\r\n- Loads ISO, CUE, CCD, CDI, CHD, MDS, and NRG";
label3.Text = i18n["maindiscoform-4559-radio-engine-hawk-longdesc-label"];
radioButton2.AutoSize = true;
radioButton2.Enabled = false;
@ -132,7 +136,7 @@ namespace BizHawk.Client.DiscoHawk
radioButton2.Name = "radioButton2";
radioButton2.Size = new(73, 17);
radioButton2.TabIndex = 5;
radioButton2.Text = "Mednafen";
radioButton2.Text = i18n["maindiscoform-7205-radio-engine-mednafen-textstr"];
radioButton2.UseVisualStyleBackColor = true;
GroupBox groupBox2 = new();
@ -147,7 +151,7 @@ namespace BizHawk.Client.DiscoHawk
groupBox2.Size = new(271, 69);
groupBox2.TabIndex = 6;
groupBox2.TabStop = false;
groupBox2.Text = "Output Format";
groupBox2.Text = i18n["maindiscoform-5561-group-hawkoutput-label"];
ccdOutputButton.AutoSize = true;
ccdOutputButton.Checked = true;
@ -156,7 +160,7 @@ namespace BizHawk.Client.DiscoHawk
ccdOutputButton.Size = new(47, 17);
ccdOutputButton.TabIndex = 5;
ccdOutputButton.TabStop = true;
ccdOutputButton.Text = "CCD";
ccdOutputButton.Text = i18n["maindiscoform-7576-radio-hawkoutput-ccd-textstr"];
ccdOutputButton.UseVisualStyleBackColor = true;
chdOutputButton.AutoSize = true;
@ -166,7 +170,7 @@ namespace BizHawk.Client.DiscoHawk
chdOutputButton.Size = new(47, 17);
chdOutputButton.TabIndex = 6;
chdOutputButton.TabStop = true;
chdOutputButton.Text = "CHD";
chdOutputButton.Text = i18n["maindiscoform-2884-radio-hawkoutput-chd-textstr"];
chdOutputButton.UseVisualStyleBackColor = true;
Label label6 = new();
@ -176,7 +180,7 @@ namespace BizHawk.Client.DiscoHawk
label6.Name = "label6";
label6.Size = new(111, 13);
label6.TabIndex = 2;
label6.Text = "Compare Reading To:";
label6.Text = i18n["maindiscoform-4639-group-compare-list-label"];
Label label7 = new();
label7.AutoSize = true;
@ -184,7 +188,7 @@ namespace BizHawk.Client.DiscoHawk
label7.Name = "label7";
label7.Size = new(70, 13);
label7.TabIndex = 10;
label7.Text = "- Operations -";
label7.Text = i18n["maindiscoform-7426-pane-operations-label"];
lvCompareTargets = new();
lvCompareTargets.Columns.Add(new ColumnHeader());
@ -193,8 +197,8 @@ namespace BizHawk.Client.DiscoHawk
lvCompareTargets.GridLines = true;
lvCompareTargets.HeaderStyle = ColumnHeaderStyle.None;
lvCompareTargets.HideSelection = false;
lvCompareTargets.Items.Add("BizHawk");
lvCompareTargets.Items.Add("Mednafen");
lvCompareTargets.Items.Add(i18n["maindiscoform-5267-compare-hawk-label"]);
lvCompareTargets.Items.Add(i18n["maindiscoform-5267-compare-mednafen-label"]);
lvCompareTargets.Location = new(9, 340);
lvCompareTargets.Name = "lvCompareTargets";
lvCompareTargets.Size = new(121, 97);
@ -221,7 +225,7 @@ namespace BizHawk.Client.DiscoHawk
MaximizeBox = false;
MinimizeBox = false;
Name = "MainDiscoForm";
Text = "DiscoHawk";
Text = i18n["maindiscoform-3997-windowtitlestatic"];
Load += (_, _) => lvCompareTargets.Columns[0].Width = lvCompareTargets.ClientSize.Width;
lblMagicDragArea.ResumeLayout(performLayout: false);
lblMp3ExtractMagicArea.ResumeLayout(performLayout: false);
@ -246,14 +250,14 @@ namespace BizHawk.Client.DiscoHawk
{
var success = DiscoHawkLogic.HawkAndWriteFile(
inputPath: file,
errorCallback: err => MessageBox.Show(err, "Error loading disc"),
errorCallback: err => MessageBox.Show(err, _i18n["discodischawking-6945-errbox-hawk-windowtitlestatic"]),
hawkedFormat: outputFormat);
if (!success) break;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Error loading disc");
MessageBox.Show(ex.ToString(), _i18n["discodischawking-3654-errbox-misc-windowtitlestatic"]);
throw;
}
finally
@ -323,9 +327,8 @@ namespace BizHawk.Client.DiscoHawk
{
#if true
MessageBox.Show(
caption: "FFmpeg missing",
text: "This function requires FFmpeg, but it doesn't appear to have been downloaded.\n"
+ "EmuHawk can automatically download it: you just need to set up A/V recording with the FFmpeg writer.");
caption: _i18n["discomp3extract-5715-errbox-noffmpeg-windowtitlestatic"],
text: _i18n["discomp3extract-5715-errbox-noffmpeg-label"]);
return;
#else
using EmuHawk.FFmpegDownloaderForm dialog = new(); // builds fine when <Compile Include/>'d, but the .resx won't load even if it's also included
@ -343,10 +346,10 @@ namespace BizHawk.Client.DiscoHawk
{
using var disc = Disc.LoadAutomagic(file);
var (path, filename, _) = file.SplitPathToDirFileAndExt();
static bool? PromptForOverwrite(string mp3Path)
bool? PromptForOverwrite(string mp3Path)
=> MessageBox.Show(
$"Do you want to overwrite existing files? Choosing \"No\" will simply skip those. You could also \"Cancel\" the extraction entirely.\n\ncaused by file: {mp3Path}",
"File to extract already exists",
string.Format(_i18n["discomp3extract-3418-prompt-overwrite-fmtstr"], mp3Path),
_i18n["discomp3extract-3418-prompt-overwrite-windowtitlestatic"],
MessageBoxButtons.YesNoCancel) switch
{
DialogResult.Yes => true,
@ -358,7 +361,7 @@ namespace BizHawk.Client.DiscoHawk
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Error loading disc");
MessageBox.Show(ex.ToString(), _i18n["discomp3extract-7691-errbox-misc-windowtitlestatic"]);
throw;
}
finally

View File

@ -122,16 +122,18 @@ namespace BizHawk.Client.DiscoHawk
if (args.Length == 0)
{
using var dialog = new MainDiscoForm();
MultiMessageContext i18n = new("en");
using MainDiscoForm dialog = new(i18n);
dialog.ShowDialog();
}
else
{
DiscoHawkLogic.RunWithArgs(
args,
results =>
results => // invoked 0..1 times
{
using var cr = new ComparisonResults { textBox1 = { Text = results } };
MultiMessageContext i18n = new("en");
using ComparisonResults cr = new(i18n) { textBox1 = { Text = results } };
cr.ShowDialog();
});
}

View File

@ -1,4 +1,107 @@
## Closing tabs
### DiscoHawk strings
## CLI COMPARE readout dialog
discohawkcomparereadout-6110-tab-dest-textstr = DST Context
discohawkcomparereadout-6110-tab-log-textstr = Log
discohawkcomparereadout-6110-tab-src-textstr = SRC Context
discohawkcomparereadout-2005-windowtitlestatic = ComparisonResults
## main window
maindiscoform-1872-area-hawkdisc-label = Drag here to HAWK your disc - dump it out as a clean CCD/CHD
maindiscoform-6011-area-mp3extract-label = Drag a disc here to extract the audio tracks to MP3
maindiscoform-5766-btn-about-textstr = &About
maindiscoform-4723-btn-exit-textstr = E&xit
maindiscoform-5267-compare-hawk-label = BizHawk
maindiscoform-5267-compare-mednafen-label = Mednafen
maindiscoform-4639-group-compare-list-label = Compare Reading To:
maindiscoform-7187-group-engine-label = Disc Reading Engine
maindiscoform-5561-group-hawkoutput-label = Output Format
maindiscoform-4559-radio-engine-hawk-textstr = BizHawk
maindiscoform-4559-radio-engine-hawk-longdesc-label =
- Uses FFMPEG for audio decoding
- Loads ISO, CUE, CCD, CDI, CHD, MDS, and NRG
maindiscoform-7205-radio-engine-mednafen-textstr = Mednafen
maindiscoform-7205-radio-engine-mednafen-longdesc-label =
- Doesn't support audio decoding yet
(even though Mednafen proper can do it)
- Loads ISO, CUE, and CCD
maindiscoform-7576-radio-hawkoutput-ccd-textstr = CCD
maindiscoform-2884-radio-hawkoutput-chd-textstr = CHD
maindiscoform-7426-pane-operations-label = - Operations -
maindiscoform-3997-windowtitlestatic = DiscoHawk
## "Hawk disc" dialogs
discodischawking-6945-errbox-hawk-windowtitlestatic = Error loading disc
discodischawking-3654-errbox-misc-windowtitlestatic = Error loading disc
## mp3 extract dialogs
discomp3extract-7691-errbox-misc-windowtitlestatic = Error loading disc
discomp3extract-5715-errbox-noffmpeg-label =
This function requires FFmpeg, but it doesn't appear to have been downloaded.
EmuHawk can automatically download it: you just need to set up A/V recording with the FFmpeg writer.
discomp3extract-5715-errbox-noffmpeg-windowtitlestatic = FFmpeg missing
discomp3extract-3418-prompt-overwrite-fmtstr =
Do you want to overwrite existing files? Choosing "No" will simply skip those. You could also "Cancel" the extraction entirely.
caused by file: {"{0}"}
discomp3extract-3418-prompt-overwrite-windowtitlestatic = File to extract already exists
## About window
discohawkabout-9804-btn-dismiss-textstr = OK
discohawkabout-4584-lbl-explainer-label =
DiscoHawk converts bolloxed-up crusty disc images to totally tidy CCD.
DiscoHawk is part of the BizHawk project ( https://github.com/TASEmulators/BizHawk ).
BizHawk is a .net-based multi-system emulator brought to you by some of the rerecording emulator principals. We wrote our own cue parsing/generating code to be able to handle any kind of junk we threw at it. Instead of trapping it in the emulator, we liberated it in the form of this tool, to be useful in other environments.
To use, drag a disc (.cue, .iso, .ccd, .cdi, .mds, .nrg) into the top area. DiscoHawk will dump a newly cleaned up CCD file set to the same directory as the original disc image, and call it _hawked.
This is beta software. You are invited to report problems to our bug tracker or IRC. Problems consist of: crusty disc images that crash DiscoHawk or that cause DiscoHawk to produce a _hawked.ccd which fails to serve your particular purposes (which we will need to be informed of, in case we are outputting wrongly.)
discohawkabout-2822-windowtitlestatic = About DiscoHawk
### strings for the Fluent sample
## Closing tabs
tabs-close-button = Close
tabs-close-tooltip = {$tabCount ->