© ecolotrain software localization localization formats characteristics, localization strategies...

Post on 28-Mar-2015

229 Views

Category:

Documents

5 Downloads

Preview:

Click to see full reader

TRANSCRIPT

© eCoLoTrain

Software localization

Localization FormatsCharacteristics, localization strategies

Dipl.-Übersetzer Daniel ZielinskiDept. 4.6 - Saarland UniversityEmail: d.zielinski@mx.uni-saarland.de

© eCoLoTrain 2

Localization Formats: Overview

• Software: RC files, Borland Delphi, Java, XML, .NET, Visual Basic, .po, XLIFF, ...

• Online help: chm, hlp, rtf• Documentation: fm, indd, doc, rtf, …• Web pages: xml, html, php, js, pl, …• Graphic files: gif, jpg, tiff, psd, …

© eCoLoTrain 3

Localization Formats: Software

• Special software formats– RC files– HTML– XML

• Meta localization formats– XLIFF

© eCoLoTrain 4

Localization Formats:

• Document formats in which localization relevant data can be stored

• Motivation and goal: separation of program code and localization data

• Programming languages offer different localization formats

• The differences depend on:– Which data is considered relevant for localization – How is data stored– How placeables and escape sequences are used

Data:- Texts- Properties used for representing interfaces in software

© eCoLoTrain 5

Localization Formats: Challenges

• External structure– Identification of localizable information– Editing without destroying/corrupting the format

• Context, scope, programming concepts– Missing context information– Inheritance– Incomplete information– Rules for target files

• Internal structure– Placeables– Escape sequences– Tags

text-based vs.

XML-based

Binary filesvs.

source files

© eCoLoTrain 6

Windows RC Files

• Standard Windows resource format• Localizable information:

– Dialogues– Menus– String tables

Information:Whereas localizable information from dialogues and menus is stored automatically in the resource files by using software development tools, this is not the case when localizable information comes from error messages and text not contained in dialogues and menus.

It is also possible that some error messages are not localized or cannot be localized.

© eCoLoTrain 7

Windows RC Files: Example

IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 55STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION |

WS_SYSMENUCAPTION "Info über SimpleSample"FONT 8, "MS Sans Serif"BEGIN ICON IDR_MAINFRAME, IDC_STATIC, 11,17,20,20 LTEXT "SimpleSample Version 1.0",

IDC_STATIC,40,10,119,8,SS_NOPREFIX LTEXT "Copyright (C) 2005", IDC_STATIC,

40,25,119,8 DEFPUSHBUTTON "&OK",IDOK,178,7,50,14,WS_GROUPEND

Exercise:Identify the localizable information

© eCoLoTrain 8

Windows RC Files: Example

IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 55STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION |

WS_SYSMENUCAPTION "Info über SimpleSample"FONT 8, "MS Sans Serif"BEGIN ICON IDR_MAINFRAME, IDC_STATIC, 11,17,20,20 LTEXT "SimpleSample Version 1.0",

IDC_STATIC,40,10,119,8,SS_NOPREFIX LTEXT "Copyright (C) 2005", IDC_STATIC,

40,25,119,8 DEFPUSHBUTTON "&OK",IDOK,178,7,50,14,WS_GROUPEND

Localizable elements:-Text- Push buttons

© eCoLoTrain 9

Windows RC Files: Example

IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 55STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION |

WS_SYSMENUCAPTION "Info über SimpleSample"FONT 8, "MS Sans Serif"BEGIN ICON IDR_MAINFRAME, IDC_STATIC, 11,17,20,20 LTEXT "SimpleSample Version 1.0",

IDC_STATIC,40,10,119,8,SS_NOPREFIX LTEXT "Copyright (C) 2005", IDC_STATIC,

40,25,119,8 DEFPUSHBUTTON "&OK",IDOK,178,7,50,14,WS_GROUPEND

Localizable elements:- Coordinates- Size specifications- Fonts- Font size

© eCoLoTrain 10

Windows RC Files: Example

IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 55STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION |

WS_SYSMENUCAPTION "Info über SimpleSample"FONT 8, "MS Sans Serif"BEGIN ICON IDR_MAINFRAME, IDC_STATIC, 11,17,20,20 LTEXT "SimpleSample Version 1.0",

IDC_STATIC,40,10,119,8,SS_NOPREFIX LTEXT "Copyright (C) 2005", IDC_STATIC,

40,25,119,8 DEFPUSHBUTTON "&OK",IDOK,178,7,50,14,WS_GROUPEND

IDs-Not very intuitive to use-Changes in the source format without having technical support can lead to errors

© eCoLoTrain 11

Windows RC Files: Tags, escape sequences

IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 55STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENUCAPTION "Meyer && Söhne"FONT 8, "MS Sans Serif"BEGIN ICON IDR_MAINFRAME, IDC_STATIC, 11,17,20,20

LTEXT "SimpleSample Version 1.0", IDC_STATIC,40,10,119,8,SS_NOPREFIX

LTEXT "Copyright (C) 2005", IDC_STATIC, 40,25,119,8

DEFPUSHBUTTON "&OK",IDOK,178,7,50,14,WS_GROUPEND

STRING TABLE DISCARDABLE BEGIN AFX_IDS_ERRMSG1 "Die Datei %s enthält %d Worte." AFX_IDS_ERRMSG2 "Die Datei %1 enthält %2 Worte." AFX_IDS_PREVIEW_CLOSE " Beendet die Seitenansicht.\nSeitenansicht

beenden"END

• '&' is a Tag and determines the access key• '&' cannot be used for itself '&' => '&&' • '&&' is the Escape sequence for '&‚ (but not always, e.g. string tables)• Escape sequences for line breaks: '\n' and for '\' is '\\'

© eCoLoTrain 12

Windows RC Files: Placeables

• Placeables are substituted with current values during runtime• %s and %d are position-sensitive placeables that are used in C

and C++• Also '%' needs escape sequence '%%'

IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 55STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENUCAPTION "Meyer && Söhne"FONT 8, "MS Sans Serif"BEGIN ICON IDR_MAINFRAME, IDC_STATIC, 11,17,20,20

LTEXT "SimpleSample Version 1.0", IDC_STATIC,40,10,119,8,SS_NOPREFIX

LTEXT "Copyright (C) 2005", IDC_STATIC, 40,25,119,8

DEFPUSHBUTTON "&OK",IDOK,178,7,50,14,WS_GROUPEND

STRINGTABLE DISCARDABLE BEGIN AFX_IDS_ERRMSG1 "Die Datei %s enthält %d Worte." AFX_IDS_PREVIEW_CLOSE "Beendet die Seitenansicht.\nSeitenansicht beenden" AFX_IDS_PREVIEW_SIZE "Zoom: %d %%"END

Problems:Changing the sentence order in the translation can lead to changes in the order of placeables, which can cause program errors

Information:In other development environments position-independent placeables are used (%1, %2)

© eCoLoTrain 13

Windows RC Files: String tables

STRINGTABLE DISCARDABLE BEGIN AFX_IDS_SCRESTORE "Stellt das Fenster in seiner normalen Größe wieder

her." AFX_IDS_SCTASKLIST "Aktiviert die ""Task-Liste""." AFX_IDS_ERROR "Quelldatei enthält %d Fehler."ENDSTRINGTABLE DISCARDABLE BEGIN AFX_IDS_PREVIEW_CLOSE "Beendet die Seitenansicht.\nSeitenansicht beenden" AFX_IDS_COMPANY_NAME "Meyer && Eriksson" END

• Double quotes (") are escaped with ("")• Line breaks and tabulators are escaped with \n and \t• Back slashes are escaped with \\• %d, %s, %1, … are used as placeables• % is escaped with %%

IDs:Connect program code and resources

• Contain symbolic names of program elements (IDs) and their external identifiers

© eCoLoTrain 14

Windows RC Files: String tables: Localization

• Localization without context information• Only indication: IDs (additional information in

program code)• IDs should not be modified• Possible insertion of comments in string tables

© eCoLoTrain 15

Windows RC Files: Localization

• Flat structure• Superposition of controls (tab controls)

time-consuming localization

© eCoLoTrain 16

Windows RC Files: Localization

• Problems with character sets & fonts– Binary resources saved always as Unicode– Programs can be Unicode- and codepage-based– Representation problems in operating systems that

are not Unicode-based (MS Win 9x/ME)• Not always localization errors

• Use of generic fonts

• Always test in localized target system

© eCoLoTrain 17

Windows RC Files: Localization

© eCoLoTrain

Software localization

EXERCISE I

© eCoLoTrain

Software localization

HTMLHyperText Markup Language

© eCoLoTrain 20

© eCoLoTrain 21

© eCoLoTrain 22

© eCoLoTrain 23

HTML: Example<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html>

<head><title>HTML localization example file</title><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><meta name="author" content="Daniel Zielinski"><meta name="keywords" content="HTML Software localization Website"><meta name="description" lang="en" content="This file should give you an example of how complex web page

localization can be."><link rel="stylesheet" type="text/css" href="./ecolotrain.css">

</head><body>

<a name="top" /><div>

<h1>HTML localization Example</h1><p>Some text to be localized in the first paragraph. For more information please visit the

<a href="http://ecolotrain.uni-saarland.de" title="Click here to get an overview about important issues in localization">eCoLoTrain website</a>.

</p></div><div>

<img src="./user.gif" alt="User icon" title="User icon for demonstration" longDesc="This icon shows you how a user in Asia looks like" /><br/><br/>

<b>A form:</b><br/><br/><form action="./result.html" method="get" accept-charset="ISO-8859-1">

Title: <select name="field0" size="1"><option value="male">Mr.</option><option value="female">Mrs.</option></select><br/>Name: <input name="field1" type="text" size="30" maxlength="30" /><br/>Address: <textarea>Type your address here...</textarea><br/>Email: <input name="field1" type="text" size="30" maxlength="30" /><br/><br/><input type="button" value="Submit" />

</form></div><div class="bottom">

<a href="#top" title="Top of page">Top</a></div>

</body></html>

© eCoLoTrain 24

HTML: Example: DTD<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html>

<head><title>HTML localization example file</title><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><meta name="author" content="Daniel Zielinski"><meta name="keywords" content="HTML Software localization Website"><meta name="description" lang="en" content="This file should give you an example of how complex web page

localization can be."><link rel="stylesheet" type="text/css" href="./ecolotrain.css">

</head><body>

<a name="top" /><div>

<h1>HTML localization Example</h1><p>Some text to be localized in the first paragraph. For more information please visit the

<a href="http://ecolotrain.uni-saarland.de" title="Click here to get an overview about important issues in localization">eCoLoTrain website</a>.

</p></div><div>

<img src="./user.gif" alt="User icon" title="User icon for demonstration" longDesc="This icon shows you how a user in Asia looks like" /><br/><br/>

<b>A form:</b><br/><br/><form action="./result.html" method="get" accept-charset="ISO-8859-1">

Title: <select name="field0" size="1"><option value="male">Mr.</option><option value="female">Mrs.</option></select><br/>Name: <input name="field1" type="text" size="30" maxlength="30" /><br/>Address: <textarea>Type your address here...</textarea><br/>Email: <input name="field1" type="text" size="30" maxlength="30" /><br/><br/><input type="button" value="Submit" />

</form></div><div class="bottom">

<a href="#top" title="Top of page">Top</a></div>

</body></html>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"

"http://www.w3.org/TR/html4/strict.dtd">

© eCoLoTrain 25

- Character set- Keywords- Description- Style sheets

HTML: Example: Header: TITLE, META, LINK<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html>

<head><title>HTML localization example file</title><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><meta name="author" content="Daniel Zielinski"><meta name="keywords" content="HTML Software localization Website"><meta name="description" lang="en" content="This file should give you an example of how complex web page

localization can be."><link rel="stylesheet" type="text/css" href="./ecolotrain.css">

</head><body>

<a name="top" /><div>

<h1>HTML localization Example</h1><p>Some text to be localized in the first paragraph. For more information please visit the

<a href="http://ecolotrain.uni-saarland.de" title="Click here to get an overview about important issues in localization">eCoLoTrain website</a>.

</p></div><div>

<img src="./user.gif" alt="User icon" title="User icon for demonstration" longDesc="This icon shows you how a user in Asia looks like" /><br/><br/>

<b>A form:</b><br/><br/><form action="./result.html" method="get" accept-charset="ISO-8859-1">

Title: <select name="field0" size="1"><option value="male">Mr.</option><option value="female">Mrs.</option></select><br/>Name: <input name="field1" type="text" size="30" maxlength="30" /><br/>Address: <textarea>Type your address here...</textarea><br/>Email: <input name="field1" type="text" size="30" maxlength="30" /><br/><br/><input type="button" value="Submit" />

</form></div><div class="bottom">

<a href="#top" title="Top of page">Top</a></div>

</body></html>

<title>HTML localization example file</title><meta http-equiv="content-type" content="text/html;

charset=ISO-8859-1"><meta name="author" content="Daniel Zielinski"><meta name="keywords" content="HTML Software

localization Website"><meta name="description" lang="en" content="This file

should give you an example of how complex web page localization can be.">

<link rel="stylesheet" type="text/css" href="./ecolotrain.css">

Header

© eCoLoTrain 26

HTML: Example: Body: H1-6, DIV, P<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html>

<head><title>HTML localization example file</title><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><meta name="author" content="Daniel Zielinski"><meta name="keywords" content="HTML Software localization Website"><meta name="description" lang="en" content="This file should give you an example of how complex web page

localization can be."><link rel="stylesheet" type="text/css" href="./ecolotrain.css">

</head><body>

<a name="top" /><div>

<h1>HTML localization Example</h1><p>Some text to be localized in the first paragraph. For more information please visit the

<a href="http://ecolotrain.uni-saarland.de" title="Click here to get an overview about important issues in localization">eCoLoTrain website</a>.

</p></div><div>

<img src="./user.gif" alt="User icon" title="User icon for demonstration" longDesc="This icon shows you how a user in Asia looks like" /><br/><br/>

<b>A form:</b><br/><br/><form action="./result.html" method="get" accept-charset="ISO-8859-1">

Title: <select name="field0" size="1"><option value="male">Mr.</option><option value="female">Mrs.</option></select><br/>Name: <input name="field1" type="text" size="30" maxlength="30" /><br/>Address: <textarea>Type your address here...</textarea><br/>Email: <input name="field1" type="text" size="30" maxlength="30" /><br/><br/><input type="button" value="Submit" />

</form></div><div class="bottom">

<a href="#top" title="Top of page">Top</a></div>

</body></html>

<div><h1>HTML localization Example</h1><p>Some text to be localized in the first paragraph. For more

information please visit the <a href="http://ecolotrain.uni-saarland.de" title="Click here to get an overview about important issues in localization">eCoLoTrain website</a>.

</p></div>

Body

- Structure tags

© eCoLoTrain 27

HTML: Example: A HREF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html>

<head><title>HTML localization example file</title><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><meta name="author" content="Daniel Zielinski"><meta name="keywords" content="HTML Software localization Website"><meta name="description" lang="en" content="This file should give you an example of how complex web page

localization can be."><link rel="stylesheet" type="text/css" href="./ecolotrain.css">

</head><body>

<a name="top" /><div>

<h1>HTML localization Example</h1><p>Some text to be localized in the first paragraph. For more information please visit the

<a href="http://ecolotrain.uni-saarland.de?L=1" title="Click here to get an overview about important issues in localization">eCoLoTrain website</a>.

</p></div><div>

<img src="./user.gif" alt="User icon" title="User icon for demonstration" longDesc="This icon shows you how a user in Asia looks like" /><br/><br/>

<b>A form:</b><br/><br/><form action="./result.html" method="get" accept-charset="ISO-8859-1">

Title: <select name="field0" size="1"><option value="male">Mr.</option><option value="female">Mrs.</option></select><br/>Name: <input name="field1" type="text" size="30" maxlength="30" /><br/>Address: <textarea>Type your address here...</textarea><br/>Email: <input name="field1" type="text" size="30" maxlength="30" /><br/><br/><input type="button" value="Submit" />

</form></div><div class="bottom">

<a href="#top" title="Top of page">Top</a></div>

</body></html>

<a href="http://ecolotrain.uni-saarland.de?L=1" title="Click here to get an overview about important issues in localization">eCoLoTrain website</a>

Hyperlinks

- Link target- Link title- Link text

© eCoLoTrain 28

HTML: Example: IMG<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html>

<head><title>HTML localization example file</title><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><meta name="author" content="Daniel Zielinski"><meta name="keywords" content="HTML Software localization Website"><meta name="description" lang="en" content="This file should give you an example of how complex web page

localization can be."><link rel="stylesheet" type="text/css" href="./ecolotrain.css">

</head><body>

<a name="top" /><div>

<h1>HTML localization Example</h1><p>Some text to be localized in the first paragraph. For more information please visit the

<a href="http://ecolotrain.uni-saarland.de" title="Click here to get an overview about important issues in localization">eCoLoTrain website</a>.

</p></div><div>

<img src="./user.gif" alt="User icon" title="User icon for demonstration" longDesc="This icon shows you how a user in Asia looks like" /><br/><br/>

<b>A form:</b><br/><br/><form action="./result.html" method="get" accept-charset="ISO-8859-1">

Title: <select name="field0" size="1"><option value="male">Mr.</option><option value="female">Mrs.</option></select><br/>Name: <input name="field1" type="text" size="30" maxlength="30" /><br/>Address: <textarea>Type your address here...</textarea><br/>Email: <input name="field1" type="text" size="30" maxlength="30" /><br/><br/><input type="button" value="Submit" />

</form></div><div class="bottom">

<a href="#top" title="Top of page">Top</a></div>

</body></html>

<img src="./user.gif" alt="User icon" title="User icon for demonstration" longDesc="This icon shows you how a user in Asia looks like" />

Graphics

- Path- Alt text- Title- Description

© eCoLoTrain 29

- Caption- Input fields- Selection fields- Check boxes- Text fields- Buttons

HTML: Example: FORM, INPUT, TEXTAREA, SELECT<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html>

<head><title>HTML localization example file</title><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><meta name="author" content="Daniel Zielinski"><meta name="keywords" content="HTML Software localization Website"><meta name="description" lang="en" content="This file should give you an example of how complex web page

localization can be."><link rel="stylesheet" type="text/css" href="./ecolotrain.css">

</head><body>

<a name="top" /><div>

<h1>HTML localization Example</h1><p>Some text to be localized in the first paragraph. For more information please visit the

<a href="http://ecolotrain.uni-saarland.de" title="Click here to get an overview about important issues in localization">eCoLoTrain website</a>.

</p></div><div>

<img src="./user.gif" alt="User icon" title="User icon for demonstration" longDesc="This icon shows you how a user in Asia looks like" /><br/><br/>

<b>A form:</b><br/><br/><form action="./result.html" method="get" accept-charset="ISO-8859-1">

Title: <select name="field0" size="1"><option value="male">Mr.</option><option value="female">Mrs.</option></select><br/>Name: <input name="field1" type="text" size="30" maxlength="30" /><br/>Address: <textarea>Type your address here...</textarea><br/>Email: <input name="field1" type="text" size="30" maxlength="30"

/><br/><br/><input type="button" value="Submit" />

</form></div><div class="bottom">

<a href="#top" title="Top of page">Top</a></div>

</body></html>

<b>A form:</b><br/><br/><form action="./result.html" method="get"

accept-charset="ISO-8859-1">Title: <select name="field0" size="1">

<option value="male">Mr.</option><option value="female">Mrs.</option>

</select><br/>

Name: <input name="field1" type="text" size="30" maxlength="30" /><br/>

Address: <textarea>Type your address here...</textarea><br/>Email: <input name="field1" type="text" size="30"

maxlength="30" /><br/><br/><input type="button" value="Submit" />

</form>

Forms

© eCoLoTrain 30

HTML: Example: Entities

• Specific characters in HTML have special functions, e.g. brackets indicate tags

• The following characters have to be escaped in HTML– & with the character string &amp; ("Ampersand")– < with the character string &lt; ("lower than")– > with the character string &gt; ("greater than")

• Character strings are referred to as HTML entities

• Entities can be also used to escape special characters:– &auml; (“umlaut“) for ä– szlig; for ß– &ccedil; for ç

Entities

© eCoLoTrain 31

HTML: Example: CSS

body {background-color:#efefef;

}div {

font-family: arial;font-size: 11px;font-color:#000000;

}div.bottom {

margin-top:800px;}form {

background-color:#ffffff;border-style:solid;border-color:#d7d7d7;border-width:1px;padding:5px;width: 290px;

}img {

background-color:#d7d7d7;border-style:solid;border-color:#d7d7d7;

}

Formatting

-Font size-Font family-Font colour-Size specification-List formatting

list-style-type: • decimal• lower-roman• upper-roman• lower-alpha oder lower-latin• upper-alpha oder upper-latin

• disc• circle • square

© eCoLoTrain 32

HTML: Example: JavaScript

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html>

<head><title>HTML localization example file</title><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><meta name="author" content="Daniel Zielinski"><meta name="keywords" content="HTML Software localization Website"><meta name="description" lang="en" content="This file should give you an example of how complex web page

localization can be."><link rel="stylesheet" type="text/css" href="./ecolotrain.css"><script type="text/javascript">

function chkFormular () {if (document.Hallo.Name.value == "") { alert("Please tell me your name!"); document.Formular.User.focus(); return false; }}

</script></head><body>

<div><h1>HTML localization Example</h1>

</div><img src="./user.gif" alt="User icon" title="User icon for demonstration" longDesc="This icon

shows you how a user in Asia looks like" /><br/><br/><b>A form:</b><br/><br/><form name="Hallo" action="" method="GET" accept-charset="ISO-8859-1" onsubmit="return

chkFormular()" >Title: <select name="field0" size="1"><option value="male">Mr.</option><option value="female">Mrs.</option></select><br/>Name: <input name="Name" type="text" size="30" maxlength="30" ><br/>Address: <textarea rows="3" cols="20">Type your address

here...</textarea><br/>Email: <input name="field1" type="text" size="30" maxlength="30"

><br/><br/><input type="submit" value="Submit" >

</form></body>

</html>

Embedded scripts <script type="text/javascript">

function chkFormular () {if (document.Hallo.Name.value == "") { alert("Please tell me your name!"); document.Formular.User.focus(); return false; }}

</script>

<form name="Hallo" action="" method="GET" accept-charset="ISO-8859-1" onsubmit="return chkFormular()" >

© eCoLoTrain 33

HTML: Localization: Challenges

• Localization of web pages time-consuming• Hypertext documents • Text, graphics, sound and video files• Style sheets• Scripts• Adaptation of forms• Adaptation of design• Update• Knowledge in different areas needed

© eCoLoTrain 34

XML

• Open standard for structured representation of contents and its relations

• Separation of content and form

• Structure: <tags> + text

• Free definition of tag names

• DTDs and schemas for definition of elements, attributes and attribute values

• Specific characters have to be escaped: < &lt; and > &gt;

• Free structure

© eCoLoTrain 35

XML: Structure

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><!DOCTYPE buch SYSTEM "buch.dtd"> <dokument>

<kapitel><ueberschrift>Überschrift</ueberschrift><absatz id=“1“>

Erster Satz. Zweiter Satz.</absatz><absatz id=“2“>

Ein satz im <fett>zweiten Absatz.</fett>

<!-- Kommentar-Text --></absatz>

</kapitel></dokument>

XML Declaration

DTD/SchemaDescription of structureDetermination of allowed elements and attributes

ElementsOpening tags +closing tags

Attributes- Attribute names- Attribute values

Comments

• Well-formed XML document: no overlapping tags, all tags closed

• Valid XML document: Structure corresponds to DTD/ schema

© eCoLoTrain 36

<document><chapter>

<heading>Heading</heading><paragraph>

First sentence. Second sentence.</paragraph><paragraph>

A sentence in the <bold>second paragraph.</bold>

</paragraph></chapter>

</document>

XML: Document view

Heading

First sentence. Second sentence. A sentence in the second paragraph.

document

chapter

first sentence..second sentence.

a sentence bold .

second paragraph

paragraph paragraphheading

heading

© eCoLoTrain 37

XML: Data view

<resources>

<string id="Dialog.Caption">Info about JavaSample</string>

<string id="Dialog.Label1">JavaSample 1.0</string>

<string id="Dialog.Label2">Copyright (C) 2005</string>

<string id="Dialog.OKButton">OK</string>

</resources>

resources

stringid=Dialog.Label1

stringid=Dialog.Label2

stringid=Dialog.OKButton

stringid=Dialog.Caption

Info about JavaSample JavaSample 1.0 Copyright (C) 2005 OK

XML as resource format

© eCoLoTrain 38

XML: Representations

<resources> <string id="Dialog.Caption">Info about JavaSample</string> <string id="Dialog.Label1">JavaSample 1.0</string> <string id="Dialog.Label2">Copyright (C) 2005</string> <string id="Dialog.OKButton">OK</string></resources>

Several possibilities for structuring XML

XML as resource format

<resources> <string><id>Dialog.Caption</id><data>Info about JavaSample</data></string> <string <id>Dialog.Label1</id><data>JavaSample 1.0</data></string> <string <id>Dialog.Label2</id><data>Copyright (C) 2005</data></string> <string <id>Dialog.OKButton</id><data>OK</data></string></resources>

Same information, different structure

<resources> <string id="Dialog.Caption" data="Info about JavaSample"</string> <string id="Dialog.Label1" data="JavaSample 1.0"</string> <string id="Dialog.Label2" data="Copyright (C) 2005"</string> <string id="Dialog.OKButton" data="OK"</string></resources>

Texts in attribute fields, empty elements

<resources> <Dialog.Caption>Info about JavaSample</Dialog.Caption> <Dialog.Label1>JavaSample 1.0</Dialog.Label1> <Dialog.Label2>Copyright (C) 2005</Dialog.Label2> <Dialog.OKButton>OK</Dialog.OKButton></resources>

XML?

© eCoLoTrain 39

XML: Complex files

<?xml version="1.0" encoding="UTF-8"?><stringlist><region xml:lang="en"> <group type="error"> <string id="2000"> <text>Cannot open file!</text> </string> <string id="2001"> <text>Not enough memory to perform operation. Close one or more applications.</text> </string> </group> <group type="message"> <string id="3000"> <text>Do you want to close the application?</text> <alt-trans> <trans>Wollen Sie die Anwendung schliessen?</trans> <trans>Soll die Anwendung beendet werden?</trans> </alt-trans> </string> <string id="3002"> <text>%1 files have been deleted.</text> </string> </group> <group type="debug"> <string id="4000"> <text>%1: Flags %2, Ref %3</text> </string> <string id="4001"> <text>DBG: filehandle %1, openflags %2</text> </string> </group></region><region xml:lang="de"> <group type="error"> <string id="2000"> <text>Datei kann nicht geöffnet werden!</text> </string> <string id="2001"> <text>Nicht genügend Speicher, um Aktion durchzuführen. Schließen Sie eine oder mehrere

Anwendungen.</text> </string> </group></region></stringlist>

XML as resource format

© eCoLoTrain 40

XML: Complex Files: Localizable elements

<?xml version="1.0" encoding="UTF-8"?><stringlist><region xml:lang="en"> <group type="error"> <string id="2000"> <text>Cannot open file!</text> </string> <string id="2001"> <text>Not enough memory to perform operation. Close one or more applications.</text> </string> </group> <group type="message"> <string id="3000"> <text>Do you want to close the application?</text> <alt-trans> <trans>Wollen Sie die Anwendung schliessen?</trans> <trans>Soll die Anwendung beendet werden?</trans> </alt-trans> </string> <string id="3002"> <text>%1 files have been deleted.</text> </string> </group> <group type="debug"> <string id="4000"> <text>%1: Flags %2, Ref %3</text> </string> <string id="4001"> <text>DBG: filehandle %1, openflags %2</text> </string> </group></region><region xml:lang="de"> <group type="error"> <string id="2000"> <text>Datei kann nicht geöffnet werden!</text> </string> <string id="2001"> <text>Nicht genügend Speicher, um Aktion durchzuführen. Schließen Sie eine oder mehrere

Anwendungen.</text> </string> </group></region></stringlist>

XML as resource format

© eCoLoTrain 41

XML: Complex Files: IDs<?xml version="1.0" encoding="UTF-8"?><stringlist><region xml:lang="en"> <group type="error"> <string id="2000"> <text>Cannot open file!</text> </string> <string id="2001"> <text>Not enough memory to perform operation. Close one or more applications.</text> </string> </group> <group type="message"> <string id="3000"> <text>Do you want to close the application?</text> <alt-trans> <trans>Wollen Sie die Anwendung schliessen?</trans> <trans>Soll die Anwendung beendet werden?</trans> </alt-trans> </string> <string id="3002"> <text>%1 files have been deleted.</text> </string> </group> <group type="debug"> <string id="4000"> <text>%1: Flags %2, Ref %3</text> </string> <string id="4001"> <text>DBG: filehandle %1, openflags %2</text> </string> </group></region><region xml:lang="de"> <group type="error"> <string id="2000"> <text>Datei kann nicht geöffnet werden!</text> </string> <string id="2001"> <text>Nicht genügend Speicher, um Aktion durchzuführen. Schließen Sie eine oder mehrere

Anwendungen.</text> </string> </group></region></stringlist>

Update

Alignment

XML as resource format

© eCoLoTrain 42

XML: Complex Files: Bilingual contents

<?xml version="1.0" encoding="UTF-8"?><stringlist><region xml:lang="en"> <group type="error"> <string id="2000"> <text>Cannot open file!</text> </string> <string id="2001"> <text>Not enough memory to perform operation. Close one or more applications.</text> </string> </group> <group type="message"> <string id="3000"> <text>Do you want to close the application?</text> <alt-trans> <trans>Wollen Sie die Anwendung schliessen?</trans> <trans>Soll die Anwendung beendet werden?</trans> </alt-trans> </string> <string id="3002"> <text>%1 files have been deleted.</text> </string> </group> <group type="debug"> <string id="4000"> <text>%1: Flags %2, Ref %3</text> </string> <string id="4001"> <text>DBG: filehandle %1, openflags %2</text> </string> </group></region><region xml:lang="de"> <group type="error"> <string id="2000"> <text>Datei kann nicht geöffnet werden!</text> </string> <string id="2001"> <text>Nicht genügend Speicher, um Aktion durchzuführen. Schließen Sie eine oder mehrere

Anwendungen.</text> </string> </group></region></stringlist>

XML as resource format

© eCoLoTrain 43

XML: Complex Files: Resource grouping

<?xml version="1.0" encoding="UTF-8"?><stringlist><region xml:lang="en"> <group type="error"> <string id="2000"> <text>Cannot open file!</text> </string> <string id="2001"> <text>Not enough memory to perform operation. Close one or more applications.</text> </string> </group> <group type="message"> <string id="3000"> <text>Do you want to close the application?</text> <alt-trans> <trans>Wollen Sie die Anwendung schliessen?</trans> <trans>Soll die Anwendung beendet werden?</trans> </alt-trans> </string> <string id="3002"> <text>%1 files have been deleted.</text> </string> </group> <group type="debug"> <string id="4000"> <text>%1: Flags %2, Ref %3</text> </string> <string id="4001"> <text>DBG: filehandle %1, openflags %2</text> </string> </group></region><region xml:lang="de"> <group type="error"> <string id="2000"> <text>Datei kann nicht geöffnet werden!</text> </string> <string id="2001"> <text>Nicht genügend Speicher, um Aktion durchzuführen. Schließen Sie eine oder mehrere

Anwendungen.</text> </string> </group></region></stringlist>

XML as resource format

© eCoLoTrain 44

XML: Complex Files: Meta information

<?xml version="1.0" encoding="UTF-8"?><stringlist><region xml:lang="en"> <group type="error"> <string id="2000"> <text>Cannot open file!</text> </string> <string id="2001"> <text>Not enough memory to perform operation. Close one or more applications.</text> </string> </group> <group type="message"> <string id="3000"> <text>Do you want to close the application?</text> <alt-trans> <trans>Wollen Sie die Anwendung schliessen?</trans> <trans>Soll die Anwendung beendet werden?</trans> </alt-trans> </string> <string id="3002"> <text>%1 files have been deleted.</text> </string> </group> <group type="debug"> <string id="4000"> <text>%1: Flags %2, Ref %3</text> </string> <string id="4001"> <text>DBG: filehandle %1, openflags %2</text> </string> </group></region><region xml:lang="de"> <group type="error"> <string id="2000"> <text>Datei kann nicht geöffnet werden!</text> </string> <string id="2001"> <text>Nicht genügend Speicher, um Aktion durchzuführen. Schließen Sie eine oder mehrere

Anwendungen.</text> </string> </group></region></stringlist>

XML as resource format

© eCoLoTrain 45

XML: Localization

• Localization with TMs or software localization tools

• XML+DTD needed for translation• Often complicated localization because of

changing structures Difficult to define localizable elements

© eCoLoTrain 46

Meta localization formats

• Resource formats which can contain information on different resource formats and additional information

• Reasons for mixing resource formats:– Parallel use of different development environments

=> resources in different resource formats (.po)– Minimization of the number of different localization

formats in workflow => use of meta formats (XLIFF)

© eCoLoTrain 47

XLIFF: Context

• Differences between localization formats:– Structure– Use of character sets– Placeables– Escape sequences– Formatting

• Relief of localizers• Idea of a consistent localization format

independent of specific localization tools

© eCoLoTrain 48

XLIFF

• XML localization Interchange File Format• Open standard• XML format• Description in form of a Schema• Bilingual approach• Most important element <trans-unit> contains

in <source> the information to be localized and in <target> the translation

• Possible inclusion of additional information• Use as native localization format (e.g. in

Macromedia Flash)http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=xliff

© eCoLoTrain 49

XLIFF

01 <?xml version="1.0"?>02 <xliff version='1.1'>03 <file datatype='winres' source-language='en' target-language='de'>04 <body>05 <group id = '1' restype = 'menu' resname = '1'>06 <trans-unit id = '1' restype = 'menupopup' style = '0x10' ts = '0'>07 <source>&amp;File</source>08 <target>&amp;Datei</target>09 </trans-unit>10 <group restype = 'popup'>11 <trans-unit id = '2' resname = '9' restype = 'menuentry' ts = '1'>12 <source>&amp;New</source>13 </trans-unit>14 <trans-unit id = '3' resname = '10' restype = 'menuentry' ts = '1'>15 <source>&amp;Open...</source>16 </trans-unit>17 </group>18 <trans-unit id = '11' restype = 'menupopup' style = '0x10' ts = '0'>19 <source>&amp;Edit</source>20 </trans-unit>21 <group restype = 'popup'>22 <trans-unit id = '12' resname = '25' restype = 'menuentry' ts = '1'>23 <source>&amp;Undo Ctrl+Z</source>24 </trans-unit>25 </group>26 </group>27 </group>28 <group id = '2' restype = 'dialog' coord = '#;#;90;64' font='MS Sans Serif;8;0'>29 <trans-unit id = '30' restype = 'caption'>30 <source>Notepad</source>31 </trans-unit>32 <trans-unit id = '31' resname = '2' restype = 'button' coord = '29;44;32;14'>33 <source>Cancel</source>34 </trans-unit>35 <trans-unit id = '32' resname = '65535' restype = 'static' coord = '0;8;90;8'>36 <source>Now Printing</source>37 </trans-unit>38 <trans-unit id = '33' resname = '20' restype = 'static' coord = '0;18;90;8'>39 <source></source>40 </trans-unit>41 </group>42 </body>43 </file>44 </xliff>

06 <trans-unit id = '1' restype = 'menupopup' style = '0x10' ts = '0'>07 <source>&amp;File</source>08 <target>&amp;Datei</target>09 </trans-unit>

© eCoLoTrain 50

XLIFF: <group>-Element

01 <?xml version="1.0"?>02 <xliff version='1.1'>03 <file datatype='winres' source-language='en' target-language='de'>04 <body>05 <group id = '1' restype = 'menu' resname = '1'>06 <trans-unit id = '1' restype = 'menupopup' style = '0x10' ts = '0'>07 <source>&amp;File</source>08 <target>&amp;Datei</target>09 </trans-unit>10 <group restype = 'popup'>11 <trans-unit id = '2' resname = '9' restype = 'menuentry' ts = '1'>12 <source>&amp;New</source>13 </trans-unit>14 <trans-unit id = '3' resname = '10' restype = 'menuentry' ts = '1'>15 <source>&amp;Open...</source>16 </trans-unit>17 </group>18 <trans-unit id = '11' restype = 'menupopup' style = '0x10' ts = '0'>19 <source>&amp;Edit</source>20 </trans-unit>21 <group restype = 'popup'>22 <trans-unit id = '12' resname = '25' restype = 'menuentry' ts = '1'>23 <source>&amp;Undo Ctrl+Z</source>24 </trans-unit>25 </group>26 </group>27 </group>28 <group id = '2' restype = 'dialog' coord = '#;#;90;64' font='MS Sans Serif;8;0'>29 <trans-unit id = '30' restype = 'caption'>30 <source>Notepad</source>31 </trans-unit>32 <trans-unit id = '31' resname = '2' restype = 'button' coord = '29;44;32;14'>33 <source>Cancel</source>34 </trans-unit>35 <trans-unit id = '32' resname = '65535' restype = 'static' coord = '0;8;90;8'>36 <source>Now Printing</source>37 </trans-unit>38 <trans-unit id = '33' resname = '20' restype = 'static' coord = '0;18;90;8'>39 <source></source>40 </trans-unit>41 </group>42 </body>43 </file>44 </xliff>

05 <group id = '1' restype = 'menu' resname = '1'>06 <trans-unit id = '1' restype = 'menupopup' style = '0x10' ts = '0'>07 <source>&amp;File</source>08 <target>&amp;Datei</target>09 </trans-unit>10 <group restype = 'popup'>11 <trans-unit id = '2' resname = '9' restype = 'menuentry' ts = '1'>12 <source>&amp;New</source>13 </trans-unit>14 <trans-unit id = '3' resname = '10' restype = 'menuentry' ts = '1'>15 <source>&amp;Open...</source>16 </trans-unit>17 </group>18 <trans-unit id = '11' restype = 'menupopup' style = '0x10' ts = '0'>19 <source>&amp;Edit</source>20 </trans-unit>21 <group restype = 'popup'>22 <trans-unit id = '12' resname = '25' restype = 'menuentry' ts = '1'>23 <source>&amp;Undo Ctrl+Z</source>24 </trans-unit>25 </group>26 </group>

Hierarchical structuring defined by <group>-Elements

© eCoLoTrain 51

XLIFF: Supporting information

01 <?xml version="1.0"?>02 <xliff version='1.1'>03 <file datatype='winres' source-language='en' target-language='de'>04 <body>05 <group id = '1' restype = 'menu' resname = '1'>06 <trans-unit id = '1' restype = 'menupopup' style = '0x10' ts = '0'>07 <source>&amp;File</source>08 <target>&amp;Datei</target>09 </trans-unit>10 <group restype = 'popup'>11 <trans-unit id = '2' resname = '9' restype = 'menuentry' ts = '1'>12 <source>&amp;New</source>13 </trans-unit>14 <trans-unit id = '3' resname = '10' restype = 'menuentry' ts = '1'>15 <source>&amp;Open...</source>16 </trans-unit>17 </group>18 <trans-unit id = '11' restype = 'menupopup' style = '0x10' ts = '0'>19 <source>&amp;Edit</source>20 </trans-unit>21 <group restype = 'popup'>22 <trans-unit id = '12' resname = '25' restype = 'menuentry' ts = '1'>23 <source>&amp;Undo Ctrl+Z</source>24 </trans-unit>25 </group>26 </group>27 </group>28 <group id = '2' restype = 'dialog' coord = '#;#;90;64' font='MS Sans Serif;8;0'>29 <trans-unit id = '30' restype = 'caption'>30 <source>Notepad</source>31 </trans-unit>32 <trans-unit id = '31' resname = '2' restype = 'button' coord = '29;44;32;14'>33 <source>Cancel</source>34 </trans-unit>35 <trans-unit id = '32' resname = '65535' restype = 'static' coord = '0;8;90;8'>36 <source>Now Printing</source>37 </trans-unit>38 <trans-unit id = '33' resname = '20' restype = 'static' coord = '0;18;90;8'>39 <source></source>40 </trans-unit>41 </group>42 </body>43 </file>44 </xliff>

28 <group id = '2' restype = 'dialog' coord = '#;#;90;64' font='MS Sans Serif;8;0'>29 <trans-unit id = '30' restype = 'caption'>30 <source>Notepad</source>31 </trans-unit>32 <trans-unit id = '31' resname = '2' restype = 'button' coord = '29;44;32;14'>33 <source>Cancel</source>34 </trans-unit>35 <trans-unit id = '32' resname = '65535' restype = 'static' coord = '0;8;90;8'>36 <source>Now Printing</source>37 </trans-unit>38 <trans-unit id = '33' resname = '20' restype = 'static' coord = '0;18;90;8'>39 <source></source>40 </trans-unit>41 </group>

© eCoLoTrain 52

XLIFF: Alternative translations

01 <?xml version="1.0"?>02 <xliff version='1.1'>03 <file datatype='winres' source-language='en' target-

language='de'>04 <body>06 <trans-unit id = '1'>07 <source>&Options</source>08 <alt-trans>09 <target>&amp;Extras</target>10 <target>&amp;Optionen</target>11 </alt-trans>12 </trans-unit>13 <trans-unit id = '2', translate = 'no'>14 <source>Copyright XYZ (C) 2004</source>15 </trans-unit>16 <trans-unit id = '3'>17 <source>Find</source>18 <note>Do not translate as Suchen</note>19 </trans-unit>20 </body>21 </file>22 </xliff>

© eCoLoTrain 53

XLIFF: Labels

01 <?xml version="1.0"?>02 <xliff version='1.1'>03 <file datatype='winres' source-language='en' target-

language='de'>04 <body>06 <trans-unit id = '1'>07 <source>&Options</source>08 <alt-trans>09 <target>&amp;Extras</target>10 <target>&amp;Optionen</target>11 </alt-trans>12 </trans-unit>13 <trans-unit id = '2', translate = 'no'>14 <source>Copyright XYZ (C) 2004</source>15 </trans-unit>16 <trans-unit id = '3'>17 <source>Find</source>18 <note>Do not translate as Suchen</note>19 </trans-unit>20 </body>21 </file>22 </xliff>

© eCoLoTrain 54

XLIFF: Comments

01 <?xml version="1.0"?>02 <xliff version='1.1'>03 <file datatype='winres' source-language='en' target-

language='de'>04 <body>06 <trans-unit id = '1'>07 <source>&Options</source>08 <alt-trans>09 <target>&amp;Extras</target>10 <target>&amp;Optionen</target>11 </alt-trans>12 </trans-unit>13 <trans-unit id = '2', translate = 'no'>14 <source>Copyright XYZ (C) 2004</source>15 </trans-unit>16 <trans-unit id = '3'>17 <source>Find</source>18 <note>Do not translate as Suchen</note>19 </trans-unit>20 </body>21 </file>22 </xliff>

© eCoLoTrain 55

XLIFF: Workflows

• Typical localization workflow without XLIFF

Source: www.oasis-open.org

© eCoLoTrain 56

XLIFF: Workflows

• Localization workflow with XLIFF

Source: www.oasis-open.org

© eCoLoTrain 57

XLIFF: Workflows

• Automated localization workflow with XLIFF and CAT tools

Source: www.oasis-open.org

© eCoLoTrain

Software localization

// Goodbye.php

if ($you == “tired“) {$action = “patience“;

}else {

$action = “attention“;}print “Thank you for your $action“; exit;

top related