Chapter 4, Exchanging Data Between an External Application
and a Basic XFA Form
XFA Specification
Localization and Canonicalization
141
Internationalized applications take into consideration varying user expectations regarding dates, times,
numbers, and currencies. Such applications present and accept information in a locale-specific format that
uses familiar characters or ideographs.
Specifying the Locale to Use During Localization and Canonicalization
The XFA template allows template designers to specify the locale to use for localization and
canonicalization. If locales are specified, they override whatever locale database is in use. This makes it
possible to correct database errors. It also makes it possible to preserve the state of a changing locale at
the time the data was provided, so that for example a document originally giving a price as 100 (100
Francs) does not suddenly change to €100 (100 Euros) just because the Euro cutover date has been
reached and the locale database updated. And it makes it possible to define custom locales to deal with
special requirements.
Note:
The XFA grammar does not support the convention
xml:lang
. If
xml:lang
appears in an XFA
template, the template fails to load. If it appears in data supplied to the XFA processing application,
it is ignored.
Locales are identified by a language code and/or a country code. Usually, both elements of a locale are
important. For example, the names of weekdays and months in English Canada and in the United
Kingdom are formatted identically, but dates are formatted differently. So, specifying an English language
locale would not suffice. Conversely, specifying only a country as the locale may not suffice either — for
example, Canada, has different date formats for English and French.
Locale may be specified at multiple levels in an XFA template, as shown in the following example. The
sequence following this example explains how the prevailing locale for a field is determined; and the table
on page
page 142
provides examples of data localized by these locales and picture clauses.
<template name="LocaleSpecificationExample">
<subform name="SubformA" locale="en_CA"> <!--English as spoken in Canada-->
<field name="FieldA" locale="fr_CA" …> <!--French as spoken in Canada-->
<bind …>
<picture …>
"date(de_CH){D. MMMM YYYY}" <!--German as spoken in Switzerlnd-->
</picture>
</bind>
<ui>
<picture …>
"D MMMM YYYY" <!--Inherits French as spoken in Canada-->
</picture>
</ui>
</field>
<field name="FieldB" …>
<ui>
<picture …>
"MMMM DD, YYYY" <!--Inherits English as spoken in Canada-->
</picture>
</ui>
</field>
</subform>
</template>
An XFA processing application determines the locale to localize/canonicalize a specific field (called the
prevailing locale)
by examining the following sources, in order:
Home Index Bookmark Pages
Pages: Home Index All Pages