Personal names in a global application: What to store

后端 未结 4 460
甜味超标
甜味超标 2020-12-01 17:20

Storing personal names in a structured way seems quite difficult when it comes to an application which is used by users from lots of different countries. The application I\'

相关标签:
4条回答
  • 2020-12-01 17:56

    There isn't really a universal structured way to do this. I'd have a big field for "Full Name" and another field for "Display Name". Both unicode.

    For example, in Spanish-speaking countries, IIRC, people usually have FOUR names. Two given names, and two surnames (one from the father, one from the mother). Arabs essentially have a linked list of names as far back as they choose to go (So-and-so, son of so-and-so, son of so-and-so, ...). East Asian countries tend to put the given names last, whilst Europeans put the given names first.

    0 讨论(0)
  • 2020-12-01 18:05

    One note: don't require both a "first name" and a "last name".

    Some people, like me, only have one name.

    (Proof: http://saizai.com/dl_redacted_small.png)

    0 讨论(0)
  • 2020-12-01 18:07

    If you are really interested in going global across all cultures, take a look at the HR-XML specification of Person. Given name & surname just doesn't cut it when you move outside of the West. Eastern standards of FamilyName GivenName will trip you up on defining FullName. Besides, you have all the potential complexities of alternate scripts (not everybody uses the Latin alphabet, y'know), prefixes and suffixes (NN Sr, van der Waals).

    It's a standard intended for transmission and integration rather than storage, but don't let the XML schema syntax scare you. I wouldn't implement every aspect of it, but it's an excellent provider of corner cases which aren't immediately obvious, and which you can then ignore consciously. In particular, check out the examples at the end!

    And for goodness' sake, don't create an American application which assumes a middle initial for everyone!

    0 讨论(0)
  • 2020-12-01 18:09

    In general, a name is a human-readable identifier of a person. For a given person, you will need to store one name for each use case of such an identifier. You will need a name to display as part of the postal address; you may need one to use as a "screen name"; you may need one to use in the openning of a letter to the person; you may sometimes need to include titles and honors of the person, sometimes not.

    In any of these cases, what you want to display is a single string. You may or may not be able to avoid duplication of effort by storing components of these strings and putting them back together later. But in general, both in terms of national culture and professional culture, you may be better off just storing the full strings.

    The same, BTW, largely occurs for postal addresses, except that there are international standards that permit the postal authority of one country to send mail to persons in another country.

    0 讨论(0)
提交回复
热议问题