Concatenating display names correctly?

by Michael S. Kaplan, published on 2006/11/03 03:01 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2006/11/03/939272.aspx


Paul's question to the alias:

Personal names in Chinese, unlike Western names, present the family/clan name first. Unlike other instances where this occurs, it is standard practice in English to also present the family name first (for example, Mao Zedong, Deng Xiaoping) [Wikipedia: Naming conventions (Chinese)].

While asking to enter first name and last name separately, I need to display name (first name + last name) in one line with proper concatenation rules (based on locale). Is there an API that will help with this, or does .NET have any way of doing that? Didn’t see anything that resembles naming concatenation rules in .NET among locale based classes like NumberFormatInfo, DateTimeFormatInfo, CompareInfo, TextInfo, CultureInfo, etc. 

There is no built-in functionality in Windows or the .NET Framework for concatenation of name pieces.

The traditional way of dealing with it is to not concatenate at all -- simply have separate controls and then simply make sure the control positions are available to localizers to change the order as appropriate.

But if you have to have a display name, what would you imagine would be the easiest engineering solution to building up the string? In a situation where your program has clear access in a dialog to the relative positions of all of the controls, it is easy to write a bit of code that concatenates the data in the controls in the same order that the localizers put the controls in, right? :-)

 

This post brought to you by (U+158e, a.k.a. CANADIAN SYLLABICS NGAAI)


# josh on 4 Nov 2006 1:03 AM:

How about using FormatMessage and letting the localizers provide the format string?

# Dean Harding on 4 Nov 2006 2:54 AM:

I don't think it's as easy as all that anyway. What happens if the locale is English (US) and you try to enter a Korean name in (for example). So you type:

First Name: Jong-Il

Last Name: Kim

vs.

First Name: Dean

Last Name: Harding

How's it supposed to tell that case #1 should written as "Kim Jong-Il" and the second as "Dean Harding"? Even a localizer can't help you, because they could both be using the same UI language.

I think the only real solution is a per-entry "Display As" control, a la the "Contacts" page in Outlook, which lets you choose:

Display As: "First Last" or "Last, First" or "Last First" etc...

Then it's a per-person option.


go to newer or older post, or back to index or month or day