Example #1
0
		private void Init()
		{
			_singleton = this;
			_catalog = new Dictionary<string, string>();
		}
Example #2
0
 private void Init()
 {
     _singleton = this;
     _catalog   = new Dictionary <string, string>();
 }
		public void MultiLines_EmtpyMsgId_Concatenated()
		{
			StringCatalog catalog = new StringCatalog(_poFile, null, 9);
			Assert.AreEqual("translated", catalog["Semantic Domains"]);
		}
		public void GetFormatted_FoundCorrectString_Formats()
		{
			StringCatalog catalog = new StringCatalog(_poFile, null, 9);
			Assert.AreEqual("first=one", StringCatalog.GetFormatted("oneParam", "blah blah", "one"));
		}
		public void ModifyFontForLocation_HugeFont_ValidFont()
		{
			StringCatalog catalog = new StringCatalog(_poFile, FontFamily.GenericSerif.Name, Single.MaxValue);
			Font normal = new Font(FontFamily.GenericSerif, Single.MaxValue);
			Font localized = StringCatalog.ModifyFontForLocalization(normal);
			Assert.IsNotNull(localized);
		}
		public void Constructor_MsgIdDiffersOnlyInCase_DoesntThrow()
		{
			string poText = @"
#: C:\src\sil\wesay-wip\bld\..\src\Addin.Backup\BackupDialog.cs
msgid 'Backing Up...'
msgstr 'aa'

#: C:\src\sil\wesay-wip\bld\..\src\Addin.Transform\LameProgressDialog.Designer.cs
msgid 'Backing up...'
msgstr 'aa'


".Replace("'", "\"");

			using (var file = new TempFile(poText))
			{
				StringCatalog catalog = new StringCatalog(file.Path, FontFamily.GenericSansSerif.Name, 12);
			}


		}
		public void FontsDoNotScaleUp()
		{
			StringCatalog catalog = new StringCatalog(_poFile, "Onyx", 30);
			Font normal = new Font(System.Drawing.FontFamily.GenericSerif, 20);
			Font localized = StringCatalog.ModifyFontForLocalization(normal);
			Assert.AreEqual(20,Math.Floor(localized.SizeInPoints));
		}
		public void FontsDoNotChange()
		{
			StringCatalog catalog = new StringCatalog(_poFile, FontFamily.GenericSansSerif.Name, 30);
			Font normal = new Font(FontFamily.GenericSerif, 20);
			Font localized = StringCatalog.ModifyFontForLocalization(normal);
			Assert.AreEqual(FontFamily.GenericSerif.Name, localized.FontFamily.Name);
		}
		public void NotListedAtAll()
		{
			StringCatalog catalog = new StringCatalog(_poFile, null, 9);
			Assert.AreEqual("notinthere", catalog["notinthere"]);
		}
		public void Normal()
		{
			StringCatalog catalog = new StringCatalog(_poFile,null, 9);
			Assert.AreEqual("deng", catalog["red"]);
		}
		public void NotTranslated()
		{
			StringCatalog catalog = new StringCatalog(_poFile, null, 9);
			Assert.AreEqual("justid", catalog["justid"]);
		}
		public void RequestedHasDoubleAmpersands_MatchesSingle()
		{
			StringCatalog catalog = new StringCatalog(_poFile, null, 9);
			Assert.AreEqual("this or that", catalog["this && that"]);
		}
		public void LongLines_NonEmtpyMsgStr_Concatenated()
		{
			StringCatalog catalog = new StringCatalog(_poFile, null, 9);
			Assert.AreEqual("onetwothree", catalog["multi2"]);
		}
		public void MultiLines_EmtpyMsgStr_Concatenated()
		{
			StringCatalog catalog = new StringCatalog(_poFile, null, 9);
			Assert.AreEqual("This is a long sentence.", catalog["multi1"]);
		}
		public void GetFormatted_TooManyParamsInCatalog_ShowsMessageAndReturnRightMessage()
		{
			StringCatalog catalog = new StringCatalog(_poFile, null, 9);
			using(new Palaso.Reporting.ErrorReport.NonFatalErrorReportExpected())
			{
				var answer = StringCatalog.GetFormatted("oneParam", "blah blah");
				Assert.AreEqual("!!first={0}", answer);
			}
		}