Esempio n. 1
0
        public void TestMissingCode()
        {
            var text = QuickTranslation.Prepare("");

            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
            var translation = text["010"];
        }
Esempio n. 2
0
        public void TestMissingLang()
        {
            var text = QuickTranslation.Prepare(
                "010:english1" + Environment.NewLine +
                "-:french2");

            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
            Assert.AreEqual("english1", text["010"]);

            Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-CA");
            Assert.AreEqual("english1", text["010"]);
        }
Esempio n. 3
0
        public void TestDuplicate()
        {
            // Duplicates are ignored.
            // We use the first one we found.

            var text = QuickTranslation.Prepare(@"
				010: english1
				- fr: french2
				- fr: french3
				
				010: english4
				- fr: french5
				- fr: french6
			"            );

            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
            Assert.AreEqual("english1", text["010"]);

            Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-CA");
            Assert.AreEqual("french2", text["010"]);
        }
Esempio n. 4
0
        public void TestBasicUsage()
        {
            var text = QuickTranslation.Prepare(@"
				# Comment.
				010: english1
				- fr: french1
				- es: spanish1
				
				020: english2
				030: english3
			"            );

            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
            Assert.AreEqual("english1", text["010"]);
            Assert.AreEqual("english2", text["020"]);
            Assert.AreEqual("english3", text["030"]);

            Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-CA");
            Assert.AreEqual("french1", text["010"]);
            Assert.AreEqual("english2", text["020"]);
            Assert.AreEqual("english3", text["030"]);
        }