W3C logo
slanted W3C logo

Cover page images (keys)

Localization of Schema Languages

Felix Sasaki, W3C

Slides

http://www.w3.org/2007/Talks/0808-extrememarkup-fs/

What is this talk about?

What is Localization?

What are Schema Languages?

What in Schema Languages can be localized?

What is so special about these tasks?

Nothing! You can do everything with your favorite schema language

So why continue listening?

Three reasons follow:

(1) Using existing locale data

(2) Applying the same information to various schema languages

(3) Mapping of localized information to the locale unspecific representation

Comparability of localized schemas

Now, how does it work?

Look into existing approaches to localization tasks. Then,

  1. Identify a locale
  2. Identify some markup (declarations)
  3. Do the localization!

Wait! What about existing approaches?

Look into

How to identify a locale?

First, what is a locale?

But we need a locale identifier, right?

CLDR provides one, is based upon BCP 47 language identifiers

de_DE@collation=phonebook,currency=DDM

How does it work (again)?

  1. Identify a locale
  2. Identify some markup (declarations)
  3. Do the localization!

Standoff usage

<loc:localInfo
 locale="de_DE"
 targetDeclaration="xs:element[@name='purchaseOrder']" ... >
 <loc:altIdent>Kaufbestellung</loc:altIdent>
</loc:localInfo>

Usage in a schema

<xs:element name="purchaseOrder">
    <xs:annotation>
        <xs:appinfo>
            <loc:localInfo locale="de_DE">
                <loc:altIdent>Kaufbestellung</loc:altIdent>
            </loc:localInfo>
        </xs:appinfo>
    </xs:annotation> ... </xs:element>

How does it work (again and again)?

  1. Identify a locale
  2. Identify some markup (declarations)
  3. Do the localization!

We have seen element renaming

... and might also translate documentation

<xs:element name="purchaseOrder">
 <xs:annotation>
  <loc:localInfo locale="de_DE">
   <loc:altDocumentation>
 Schema zu Kaufbestellungen</loc:altDocumentation> ... </xs:element>

Modification of data types

Target date data type

<loc:localInfo locale="de">
 <loc:dateInfo calendarType="Gregorian" 
 dateFormatLengthType="long"/>
</loc:localInfo>

How to get data out of CLDR?

Using specific calendar types and date format types from CLDR

<dateFormatLength type="long">
 <dateFormat>
 <pattern>d. MMMM yyyy</pattern>
 </dateFormat>
</dateFormatLength>

What are these patterns in CLDR?

d. MMMM yyyy says:

E.g., 8. August 2007

How can these CLDR patterns be used?

Input from CLDR mainly "d. MMMM yyyy"

Generating data type patterns for XML Schema data types

<xs:pattern
 value="\d{1,2}\.\s+(Januar|Februar|März|April|Mai|Juni|Juli|August
 |September|Oktober|November|Dezember)\s+\d{4}"/>

then, replace xs:date with the pattern

How does mapping to locale unspecific data work?

Input

Output 2007-08-08

Show me some more CLDR data for data type modification

Locale display names for English en from CLDR

<localeDisplayNames>
  <languages>
   <language type="de">German</language> [...] </languages>
  <scripts>
   <script type="Latn">Latin</script> [...] </scripts>
  <territories>
   <territory type="DE">Germany</territory> [...] </territories>
 [...]</localeDisplayNames>

Show me some even more CLDR data!

Locale display names for German de from CLDR

 <localeDisplayNames>
  <languages>
   <language type="de">Deutsch</language> [...] </languages>
  <scripts>
   <script type="Latn">Lateinisch</script> [...] </scripts>
  <territories>
   <territory type="DE">Deutschland</territory> [...] </territories>
 [...]</localeDisplayNames>

How can such locale display names be used?

Generation of code lists

<xs:element name="language">
 <xs:annotation>
 <xs:appinfo>
  <loc:localInfo locale="de">
   <loc:localeDisplayNames type="languages"/>
  </loc:localInfo>
 </xs:appinfo>
</xs:annotation> ... </xs:element>

I might think it's great, if it really works ...

... it's being implemented with

Is it worth it?

Questions?