从数据库字段定位邮政/物理地址显示 [英] localising postal / physical address display from database fields

查看:193
本文介绍了从数据库字段定位邮政/物理地址显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以给我一个国际邮政/住宅/交付地址格式模板的列表,使用某种可解析的标准词汇表的地址部分?



理想的列表包含一个国家代码,然后是一个使用可替换的标记的格式,所以我可以用数据库地址字段替换成一个模板来生成本地格式的可打印的东西。 >

例如

  NZ | [first_name] [family_name] \\\
[company_name] \\\
[street_address] \\\
[city] [post_code] \\\
[country]
AU | [first_name] [family_name] \\\
[company_name] \\\
[street_address] \\\
[city] \\\
[state] [post_code] \\\
[country]
US | etc
UK | etc

背景:我曾经有一个简单的自由文本字段来接受地址。移动到支持电子名片下载,这需要地址分解成特定的领域。这一切都很好:我们可以做移民。我正在寻找一种方法来显示每个国家的正确的顺序字段。感谢您的帮助!

解决方案

Google有一个基于JSON的API ,用于 Android地址输入字段库包含这种格式的信息。



您感兴趣的字段是 fmt 。似乎没有关于他们使用的格式的任何正式文件,但包含此信息的提案作为Unicode的一部分CLDR具有匹配的字段(向下滚动到详细的元素分解);也有一些线索在 Google的libaddressinput源代码


Can anyone point me to a list of international postal / residential / delivery address format templates that use some kind of parseable standard vocabulary for address parts?

The ideal list contains a country code then a format using replaceable tokens so I can substitute database address fields into a template to produce something printable in the local format.

for example

NZ | [first_name] [family_name]\n[company_name]\n[street_address]\n[city] [post_code]\n[country]
AU | [first_name] [family_name]\n[company_name]\n[street_address]\n[city]\n[state] [post_code]\n[country]
US | etc
UK | etc

Background: I used to have a simple freetext field to accept addresses. Moving to support vCard download, which requires addresses to be broken down into specific fields. Thats all fine: we can do the migration. I'm looking for a way to display the fields in the "correct" order for each country. thanks for your help!

解决方案

Google have a JSON-based API that they use for their Android address input field library that contains this kind of formatting information.

The field you'd be interested in is fmt. There doesn't seem to be any formal documentation on the format they use, but a proposal to include this information as part of the Unicode CLDR has matching fields (scroll down to "Detailed Breakdown of elements"); there are also some clues in Google's libaddressinput source code.

这篇关于从数据库字段定位邮政/物理地址显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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