开发者

Does .NET provide a way of knowing the order of first and last name in the current thread culture?

That's mainly the question.

In Japan, the first name follows the family name. A person with the first name "Ichiro" and the family nam开发者_StackOverflowe "Suzuki" is, therefore, called "Suzuki Ichiro" rather than "Ichiro Suzuki".

I'd like to be able to know which cultures have this behaviour with first and last names, does .NET provide a way of knowing this for the current culture?


No, the localization and globalization libraries do not hold this information.

The CultureInfo classes mostly hold calendar and numeric formatting information (and other bits and bobs), but nothing like what you are looking for.


There is no such library (yet) as far as I know, but you can always move that information to the resx file, read that out at runtime and use string.Format to actually obtain what you are looking for. The code would be similar to this:

// that should be in resources, so in Japanese and Hungarian
// it would look like {1} {0}
var namePattern = "{0} {1}";
var name = string.Format(namePattern, firstName, lastName);

The only problem is, you need to somehow obtain these information, i.e. ask translators to provide it. This could be problematic if you are not going to localize the application in given language.

BTW. Besides Japan, it is quite typical for Asian countries not to distinguish between first name and last name...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜