# HG changeset patch
# User Dan.Kulinski@dank-laptop.Global.Local
# Date 1314194838 21600
# Node ID a3e62a2c267f125c2b84733dcb44b49c34a420e9
# Parent 83685ed69c69ada0e3ca40086d0d1de04f9f464b
Added translation support for exceptional cases
diff -r 83685ed69c69 -r a3e62a2c267f FrmXmlExport.cs
--- a/FrmXmlExport.cs Mon Aug 22 17:20:05 2011 -0600
+++ b/FrmXmlExport.cs Wed Aug 24 08:07:18 2011 -0600
@@ -8,8 +8,10 @@
using System.IO;
using System.Windows.Forms;
using System.Xml.Xsl;
+using IBBoard.Lang;
using IBBoard.WarFoundry.API.Objects;
using IBBoard.WarFoundry.API.Exporters;
+using System.Xml.Xsl;
namespace IBBoard.WarFoundry.GUI.WinForms
{
@@ -27,11 +29,6 @@
tbXslPath.Text = Directory.GetCurrentDirectory() + "\\xsl\\default_html.xsl";
}
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
-
- }
-
private void bttnOutputSelect_Click(object sender, EventArgs e)
{
SaveFileDialog sfd = new SaveFileDialog();
@@ -53,22 +50,49 @@
private void bttnExport_Click(object sender, EventArgs e)
{
- if (cbApplyTransform.Checked)
+ string errorMessage = "";
+ // Catch potential errors with the file export or XSL compiliation
+ try
{
- try
+ if (cbApplyTransform.Checked)
{
WarFoundryXmlWithXslExporter.GetDefault().ExportArmyWithTransform(myArmy, tbOutputFile.Text, tbXslPath.Text);
}
- catch (Exception ex)
+ else
{
- MessageBox.Show(this, "Sorry, but an error occurred during export.", "Error on export", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+ WarFoundryXmlWithXslExporter.GetDefault().ExportArmy(myArmy, tbOutputFile.Text);
}
}
- else
+ catch (XsltCompileException ex)
+ {
+ errorMessage = Translation.GetTranslation("mbErrorCompileFailed", "") +
+ ":\n" + ex.Message;
+ }
+ catch (XsltException ex)
+ {
+
+ errorMessage = Translation.GetTranslation("mbErrorXSLTFailed", "") +
+ ":\n" + ex.Message;
+ }
+ catch (FileNotFoundException ex)
{
- WarFoundryXmlWithXslExporter.GetDefault().ExportArmy(myArmy, tbOutputFile.Text);
+ errorMessage = Translation.GetTranslation("mbErrorFileNotFoundFailed", "") +
+ ":\n" + ex.Message;
+ }
+ catch (IOException ex)
+ {
+ errorMessage = Translation.GetTranslation("mbErrorIOFailed", "") +
+ ":\n" + ex.Message;
}
-
+ catch (Exception ex)
+ {
+ errorMessage = Translation.GetTranslation("mbErrorFailed", "") +
+ ":\n" + ex.Message;
+ }
+ if (errorMessage != "")
+ {
+ MessageBox.Show(errorMessage, "Error During Export", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
this.DialogResult = DialogResult.OK;
this.Hide();
}
diff -r 83685ed69c69 -r a3e62a2c267f translations/de.translation
--- a/translations/de.translation Mon Aug 22 17:20:05 2011 -0600
+++ b/translations/de.translation Wed Aug 24 08:07:18 2011 -0600
@@ -122,5 +122,10 @@
Einstellungen
Sprache
Sprache:
- Sprache
+ Sprache
+ Failed to compile XSL translation
+ Failed to load XSL translation
+ Failed to load XSL translation
+ Failed to output file
+ Failed to export
\ No newline at end of file
diff -r 83685ed69c69 -r a3e62a2c267f translations/en.translation
--- a/translations/en.translation Mon Aug 22 17:20:05 2011 -0600
+++ b/translations/en.translation Wed Aug 24 08:07:18 2011 -0600
@@ -132,4 +132,9 @@
{0} ({1} {2})
( {0} {1} each)
Army Requirement Failures
+ Failed to compile XSL translation
+ Failed to load XSL translation
+ Failed to load XSL translation
+ Failed to output file
+ Failed to export
\ No newline at end of file
diff -r 83685ed69c69 -r a3e62a2c267f translations/fi.translation
--- a/translations/fi.translation Mon Aug 22 17:20:05 2011 -0600
+++ b/translations/fi.translation Wed Aug 24 08:07:18 2011 -0600
@@ -124,6 +124,11 @@
Kieli:
Kieli
Pelisysteemi ja rotutiedostot ovat ladatut.
+ Failed to compile XSL translation
+ Failed to load XSL translation
+ Failed to load XSL translation
+ Failed to output file
+ Failed to export
diff -r 83685ed69c69 -r a3e62a2c267f translations/fr.translation
--- a/translations/fr.translation Mon Aug 22 17:20:05 2011 -0600
+++ b/translations/fr.translation Wed Aug 24 08:07:18 2011 -0600
@@ -109,4 +109,9 @@
{1} {0}
{0}, {1}
{0} peut être sélectionné seulement si l'objet suivant est sélectionné : {1}
+ Failed to compile XSL translation
+ Failed to load XSL translation
+ Failed to load XSL translation
+ Failed to output file
+ Failed to export
\ No newline at end of file
diff -r 83685ed69c69 -r a3e62a2c267f translations/it.translation
--- a/translations/it.translation Mon Aug 22 17:20:05 2011 -0600
+++ b/translations/it.translation Wed Aug 24 08:07:18 2011 -0600
@@ -123,4 +123,9 @@
Lingua
Lingua:
Lingua
+ Failed to compile XSL translation
+ Failed to load XSL translation
+ Failed to load XSL translation
+ Failed to output file
+ Failed to export
\ No newline at end of file
diff -r 83685ed69c69 -r a3e62a2c267f translations/nl.translation
--- a/translations/nl.translation Mon Aug 22 17:20:05 2011 -0600
+++ b/translations/nl.translation Wed Aug 24 08:07:18 2011 -0600
@@ -108,4 +108,9 @@
{1} {0}
{0}, {1}
{0} kan alleen gekozen worden als een van de volgende dingen genomen is: {1}
+ Failed to compile XSL translation
+ Failed to load XSL translation
+ Failed to load XSL translation
+ Failed to output file
+ Failed to export
\ No newline at end of file
diff -r 83685ed69c69 -r a3e62a2c267f translations/ru.translation
--- a/translations/ru.translation Mon Aug 22 17:20:05 2011 -0600
+++ b/translations/ru.translation Wed Aug 24 08:07:18 2011 -0600
@@ -94,4 +94,9 @@
Поменять название "{0}" на "{1}"
Сделать размер {0} - {1}
Сделать размер {0} - {1}
+ Failed to compile XSL translation
+ Failed to load XSL translation
+ Failed to load XSL translation
+ Failed to output file
+ Failed to export
\ No newline at end of file
diff -r 83685ed69c69 -r a3e62a2c267f translations/sv.translation
--- a/translations/sv.translation Mon Aug 22 17:20:05 2011 -0600
+++ b/translations/sv.translation Wed Aug 24 08:07:18 2011 -0600
@@ -131,5 +131,9 @@
Aktuellt poängvärde för armé
{0} ({1} {2})
( {0} {1} var)
-
+ Failed to compile XSL translation
+ Failed to load XSL translation
+ Failed to load XSL translation
+ Failed to output file
+ Failed to export