summaryrefslogtreecommitdiff
path: root/chromium/docs/website/site/developers/design-documents/form-autofill/internationalization-of-autofill/index.md
blob: ca8affd156b4934d3509b182d14001bae8e6a2bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
---
breadcrumbs:
- - /developers
  - For Developers
- - /developers/design-documents
  - Design Documents
- - /developers/design-documents/form-autofill
  - Form Autofill
page_name: internationalization-of-autofill
title: Internationalization of Autofill
---

**Objective**
To extend the Autofill feature in Chrome to better handle non-English and non-US
pages and user address and credit card information.

## Background

The Autofill feature shipped with Chrome 6. Localization of the Autofill UI was
achieved, but opportunities to provide deeper internationalization of the
feature exist.

User Experience

**Addresses**

The addresses stored in Autofill settings/preferences will better adapt to
non-US addresses. For example, a Canadian address will present "Postal Code"
instead of "Zip Code". Additional fields such as "Prefecture" may be appropriate
in Japan.

The "Country" field will use a popup selection of countries. This allows for
more dynamic structure for locale-specific address information.

> > [<img alt="image"
> > src="/developers/design-documents/form-autofill/internationalization-of-autofill/autofill_i18l_address_ui.jpg">](/developers/design-documents/form-autofill/internationalization-of-autofill/autofill_i18l_address_ui.jpg)

For different regions, such as Japan, additional local-specific fields may be
introduced. For example, notice "Prefecture" below. Notice also the renaming of
"Zip code" to "Postal code" and reordering of fields:

> > [<img alt="image"
> > src="/developers/design-documents/form-autofill/internationalization-of-autofill/autofill_i18l_address_jp_ui.jpg">](/developers/design-documents/form-autofill/internationalization-of-autofill/autofill_i18l_address_jp_ui.jpg)

**Form Field Matching**

Autofill analyses web pages to find appropriate form fields for filling. This
analysis will be enhanced to cover a greater variety of non-English pages.

**HTML / JavaScript based UI**

Platform-specific UI for Autofill will be deprecated in favor of HTML /
JavaScript based UI (aka "DOMUI"). Internationalization of Autofill will apply
to this new DOMUI only. Dynamic layout of the Autofill user preferences will be
data-driven based on declarative descriptions of locale-specific address
formats.

**Implementation**
**Data Structures**

****Locale information is sourced from three places:****

1.  Application Locale. The locale of the running Chrome application.
2.  Form Locale. The locale information, if any, associated with the
            HTML page containing the form.
3.  Address Locale. The locale dictated by the address "Country" field
            set by the user in Autofill preferences.

**Program Flow**

**During page-load Autofill analyses the forms within the page for fillable
fields. Program flow (A) is the current flow of control through the system.**

**Forms may or may not contain locale information directly, in which case we
attempt to derive the locale by other means. The strategy employed is as
follows:**

**1.**

**********The FormManager will be enhanced to pull locale information from the
WebKit DOM (see (B) in the diagram below).**********

**Give preference to local information set in the HTML markup.****

****For example:******

**&lt;form lang="fr-CA"&gt;...&lt;/form&gt;**

**&lt;div lang="fr-CA"&gt;&lt;form&gt;...&lt;/form&gt;&lt;/div&gt;**

**&lt;html&gt;&lt;head&gt;&lt;meta http-equiv="Content-Language"
content="fr-CA"/&gt;&lt;/head&gt;...&lt;/html&gt;**

**Would all yield a Form Locale of "fr-CA".**

**2. If no locale information is set by the page author, then the textual contents of the page are analysed.**

****The Compact Language Detection ( src/third_party/cld/... ) module is
utilized for this****

**********(see (C) in diagram below)************

****.******

**3.**

******URL top-level domain suffix may also be used if other sources of
information about locale are not present (not pictured).******

<img alt="image"
src="/developers/design-documents/form-autofill/internationalization-of-autofill/autofill_i18n_design.jpg">