diff --git a/umbraco/presentation/umbraco/translation/default.aspx.cs b/umbraco/presentation/umbraco/translation/default.aspx.cs index 3e76cda6b1..db55f8e8c0 100644 --- a/umbraco/presentation/umbraco/translation/default.aspx.cs +++ b/umbraco/presentation/umbraco/translation/default.aspx.cs @@ -17,6 +17,7 @@ using ICSharpCode.SharpZipLib.Zip.Compression; using ICSharpCode.SharpZipLib.Zip.Compression.Streams; using ICSharpCode.SharpZipLib.GZip; using umbraco.IO; +using System.Collections.Generic; namespace umbraco.presentation.translation { @@ -103,28 +104,52 @@ namespace umbraco.presentation.translation try { StringBuilder sb = new StringBuilder(); - foreach (FileInfo translationFileXml in new DirectoryInfo(ViewState["zipFile"].ToString()).GetFiles("*.xml")) { - try { - Task translation = importTranslatationFile(translationFileXml.FullName); - sb.Append("
  • " + translation.Node.Text + " " + ui.Text("preview") + "
  • "); - } catch (Exception ee) { + foreach (FileInfo translationFileXml in new DirectoryInfo(ViewState["zipFile"].ToString()).GetFiles("*.xml")) + { + try + { + foreach (Task translation in importTranslatationFile(translationFileXml.FullName)) + { + + sb.Append("
  • " + translation.Node.Text + " " + ui.Text("preview") + "
  • "); + } + } + catch (Exception ee) + { sb.Append("
  • " + ee.ToString() + "
  • "); } } feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.success; - feedback.Text = "

    " + ui.Text("translation", "MultipleTranslationDone") + "

    " + ui.Text("translation","translationDoneHelp") + "

    "; + feedback.Text = "

    " + ui.Text("translation", "MultipleTranslationDone") + "

    " + ui.Text("translation", "translationDoneHelp") + "

    "; } - catch (Exception ex) { + catch (Exception ex) + { feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.error; feedback.Text = "

    " + ui.Text("translation", "translationFailed") + "

    " + ex.ToString() + ""; } } else { - Task t = importTranslatationFile(tempFileName); - feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.success; - feedback.Text = "

    " + ui.Text("translation", "translationDone") + "

    " + ui.Text("translation", "translationDoneHelp") + "

    " + ui.Text("preview") + "

    "; + StringBuilder sb = new StringBuilder(); + List l = importTranslatationFile(tempFileName); + + if (l.Count == 1) + { + feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.success; + feedback.Text = "

    " + ui.Text("translation", "translationDone") + "

    " + ui.Text("translation", "translationDoneHelp") + "

    " + ui.Text("preview") + "

    "; + } + + else + { + foreach (Task t in l) + { + sb.Append("
  • " + t.Node.Text + " " + ui.Text("preview") + "
  • "); + } + + feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.success; + feedback.Text = "

    " + ui.Text("translation", "MultipleTranslationDone") + "

    " + ui.Text("translation", "translationDoneHelp") + "

    "; + } } // clean up @@ -136,10 +161,12 @@ namespace umbraco.presentation.translation pane_uploadFile.Visible = false; pane_tasks.Visible = false; } - private Task importTranslatationFile(string tempFileName) + private List importTranslatationFile(string tempFileName) { try { + List tl = new List(); + // open file XmlDocument tf = new XmlDocument(); tf.XmlResolver = null; @@ -173,10 +200,12 @@ namespace umbraco.presentation.translation t.Save(); - return t; + tl.Add(t); } } } + + return tl; } catch (Exception ee) {