Facebook名称根据国家/地区正确订购和显示 [英] Facebook name ordering and displaying correctly based on country

查看:269
本文介绍了Facebook名称根据国家/地区正确订购和显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看着将Facebook API提供的名称分成两行,并希望根据该人的原籍国正确显示。因此,

I looking at splitting the name supplied by the Facebook API across two lines and I want this to display correctly depending of the country of origin of the person. So the western standard of

Given Name
Family Name

适用时,

Family Name
Given Name

维基/姓氏#Order_of_namesrel =nofollow>名称应该相反

in countries where the names should be reversed

Facebook提供了许多名称字段

Facebook supply a number of name fields


  1. 名称 - 该人的全名

  2. name_format - 该人的姓名

  3. first_name - 该人的名字

  4. last_name - 该人的姓氏。

  1. name - The person's full name
  2. name_format - The person's name formatted to correctly handle Chinese, Japanese, Korean ordering.
  3. first_name - The person's first name
  4. last_name - The person's last name.

我假定名称总是[给定名称] [家庭名称](也可能包括中间名?)

I assume name is always [Given Name] [Family Name] (may also include middle name?)

name_format 听起来像是正确显示顺序的名称

name_format sounds like it'll be the name in the correct display order

我不确定 first_name last_name 是显示顺序的指标,还是 first_name = [给定名称]和 last_name = [姓氏],如美国假定的那样?

I'm not sure if first_name and last_name is the indicator of display order, or is first_name = [given name] and last_name = [family name] as would be assumed in the US?

真正的问题是如何将Facebook显示名称分解成给定的名称和姓氏,然后确保我正确的显示它们。

The real question is how can I split the Facebook display name into given name and family name and then ensure I'm displaying them in the correct order.

推荐答案

p>经过一些更多的研究,结果是 name_format 不返回:

After some more research it turns out the name_format does not return:


该人的名称格式正确处理中文,日语,
韩国订购。

The person's name formatted to correctly handle Chinese, Japanese, Korean ordering.

如API所述,但更像是名称建议,这是名称的格式。在我的例子中,API调用的返回值如下。

As detailed on the API, but something more akin to what the name would suggest, which is the formatting for the name. In my instance the return from the API call is as follows.

  "name": "Will Calderwood", 
  "name_format": "{first} {last}"

我认为,韩国地区将是

  "name": "Calderwood Will", 
  "name_format": "{last} {first}"

所以 name_format 可以用来分解命名并以正确的顺序显示。

So the name_format can be used to break up the name and display it in the correct order.

这篇关于Facebook名称根据国家/地区正确订购和显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆