android - 在 Android 应用程序中针对不同的语言环境本地化人名

标签 android localization internationalization

在某些语言环境中,一个人的全名是先写姓氏(姓氏,姓氏)然后写名(人名,教名),而不是更常见的先名后姓的顺序。有没有API在 Android 中,它可以根据手机的区域设置为我的应用程序处理此名称排序。

最佳答案

恐怕没有相应的 API。我一直在寻找它一段时间,我所知道的就是@Shervin 分享的内容。

目前:

您可以尝试通过从用户那里获取头衔、姓名、第二名和姓氏来自行管理这些内容。在英语中,很容易正确排序并将其与空格连接起来。不幸的是 - not every language use spaces .

研究:

CLDR 是提供任何特定于语言环境的数据(例如在 ICU 中)的项目,但名称和姓氏的顺序 is not there .

可能的解决方案:

大多数解决方案可以总结为:

If designing a form or database that will accept names from people with a variety of backgrounds, you should ask yourself whether you really need to have separate fields for given name and family name. Sometimes you may opt for separate fields because you want to be able to use part of the name to address the person directly, or refer to them. For example, when Google+ refers to "Richard's contacts". Or perhaps it's because you want to send them emails with their name at the top. Note that not only may you have problems due to name syntax here, but you also have to account for varying expectations around the world with regards to formality (not everyone is happy for a stranger to call them by their given name). It may be better to ask separately, when setting up a profile for example, how that person would like you to address them.

http://www.w3.org/International/questions/qa-personal-names#fielddesign

因此您必须选择是否需要分别询问您的用户的名字和姓氏(应该有助于排序),但即便如此 - 您需要知道他们的名字应该如何显示。

大多数情况下,您会看到要求用户提供的表单:名字、姓氏和显示名称。检查here (第四标题)进行解释。

关于android - 在 Android 应用程序中针对不同的语言环境本地化人名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27748365/

相关文章:

android - 可以移动平铺背景吗? (使用 TileMode.REPEAT 无限滚动)

android - 如何在 Firebase 中向数组添加新对象

objective-c - 本地化串联或动态字符串

javascript - .NET MVC 本地化 (JavaScript)

Android:以编程方式检测设备是否有硬件菜单按钮

android - 在 Photoshop for Android 中创建 XHDPI、HDPI、MDPI、LDPI 图像

ios - 无法从 Localizable.strings 文件中检索本地化字符串

java - 可以安全地假设 Spring MessageSource 实现是线程安全的吗?

mysql - 将 MySQL 表从 Latin1 转换为 UTF8 时整理丢失的信息

python - 处理django查询中的外来字符