Ejemplo n.º 1
0
        private void Localize()
        {
            /* SNIPPET 1: START */
            client.Culture = new CultureInfo("en-US");
            /* SNIPPET 1: END */

            /* SNIPPET 2: START */
            // Access from the client object (uses client.Culture as input)
            string translated = client.Localize("reliabilityEnumSet.reliable");

            Console.WriteLine(translated);

            /*
             *  Reliable
             */
            // Access without instantiating a client
            translated = ResourceManager.Localize("reliabilityEnumSet.reliable",
                                                  new CultureInfo("it-IT"));
            Console.WriteLine(translated);

            /*
             *  Affidabile
             */
            /* SNIPPET 2: END */
        }
Ejemplo n.º 2
0
        public void TestLocalizeCultureDefault(string reliable, string unsupported, string priority, string array)
        {
            Assert.AreEqual(reliable, client.Localize(Reliable));
            Assert.AreEqual(unsupported, client.Localize(Unsupported));
            Assert.AreEqual(priority, client.Localize(PriorityNone));
            Assert.AreEqual(array, client.Localize(Array));

            Assert.AreEqual(reliable, ResourceManager.Localize(Reliable));
            Assert.AreEqual(unsupported, ResourceManager.Localize(Unsupported));
            Assert.AreEqual(priority, ResourceManager.Localize(PriorityNone));
            Assert.AreEqual(array, ResourceManager.Localize(Array));
        }