954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Cross project resources doesn't actually work!

Hi guys!
I got an headache with mutilingual resource cross project.
Let's imagine that I have 2 project:
Project #1: Console
Label.resx
Hello: Hello
Label.vi-VN.resx
Hello: Xin chao
("Xin chao" mean "Hello" in Vietnamese)

In project #1, I make a Main method inside Program class

class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(Label.Hello);
            Thread.CurrentThread.CurrentCulture = new CultureInfo("vi-VN");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("vi-VN");
            Console.WriteLine(Label.Hello);
        }
    }

And it output "Hello\nXin chao" as intended.
Project #2: Tests
MS Test project, I assert whether the reference cross project still work fine

[TestMethod()]
        public void MainTest()
        {
            Assert.AreEqual("Hello", Label.Hello);
            Thread.CurrentThread.CurrentCulture = new CultureInfo("vi-VN");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("vi-VN");
            Assert.AreEqual("Xin chao", Label.Hello);

        }

And the test failed. The Label.Hello always return "Hello", despite the change in CurrentUICulture and CurrentCulture.
Anyway to make the test pass?
Thanks.

coldboyqn
Newbie Poster
2 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

Look like the situation is too odd for anyone to have any idea about it?

coldboyqn
Newbie Poster
2 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You