public void ShouldTrimLeadingQuotes() { var parser = new LocalizationStreamParser(); var text = new StringBuilder(); text.AppendLine("#: ~/Themes/MyTheme/Views/MyView.cshtml"); text.AppendLine("msgctxt \"~/Themes/MyTheme/Views/MyView.cshtml\""); text.AppendLine("msgid \"\\\"{0}\\\" Foo\""); text.AppendLine("msgstr \"\\\"{0}\\\" Foo\""); var translations = new Dictionary <string, string>(); parser.ParseLocalizationStream(text.ToString(), translations, false); Assert.AreEqual("\"{0}\" Foo", translations["~/themes/mytheme/views/myview.cshtml|\"{0}\" foo"]); }
public void ShouldHandleUnclosedQuote() { var parser = new LocalizationStreamParser(); var text = new StringBuilder(); text.AppendLine("#: ~/Themes/MyTheme/Views/MyView.cshtml"); text.AppendLine("msgctxt \""); text.AppendLine("msgid \"Foo \\\"{0}\\\"\""); text.AppendLine("msgstr \"Foo \\\"{0}\\\"\""); var translations = new Dictionary <string, string>(); parser.ParseLocalizationStream(text.ToString(), translations, false); Assert.AreEqual("Foo \"{0}\"", translations["|foo \"{0}\""]); }