Internationalizing your application

Post on 20-Jun-2015

1.883 views 0 download

Tags:

description

Talk presented at CakeFest 2011, in Manchester-UK.

Transcript of Internationalizing your application

INTERNATIONALIZING YOUR APPLICATION

by Renan Gonçalves

S

Sunday, September 4, 11

WHO IS THIS GUY?

Software Engineer

TrueServer B.V.

CakePHP since 2007

Contributing since 2008

Brazilian

Sunday, September 4, 11

LOCALIZATION

Adapting or converting the application to be used on a particular locale

Locale defines:

User’s language

Country

Sunday, September 4, 11

LOCALE

en

en_US

cs_CZ.UTF-8

pt_BR@CE

language[_territory][.charset][@modifier]

Sunday, September 4, 11

LOCALE

en_GB en_GB@oed en_CA en_US

analyse analyse analy[sz]e analyze

behaviour behaviour behaviour behavior

centre centre centre center

defence defence defence defense

globalisation globalization globalization globalization

realise realize realize realizehttp://en.wikipedia.org/wiki/En-GB-oed#Language_tag_comparison

Sunday, September 4, 11

INTERNATIONALIZATION

Supporting international data

Text Content

Numbers

Currencies

Dates / Times

Calendars

Sunday, September 4, 11

LANGUAGE

Different systems of numerals

decimal (10), vigesimal (20), octogesimal (80), etc

Writing direction

left to right and right to left

Graphical representation of texts

Audio

Sunday, September 4, 11

WRITING CONVENTIONS

Date/time format

Different calendars

Time zones

Number formatting

Difference in symbols

Sunday, September 4, 11

CULTURE

Sunday, September 4, 11

CULTURE

Images and colors

Telephone numbers

Currency

Symbols, format

Weights and measures

Government assigned numbers

Sunday, September 4, 11

OTHERS

National variants of languages

Local content

Order of sorting (collation)

Sunday, September 4, 11

WHY CARE?

World, 7 billion.China, 1.3 billion. US, 312 million. Brazil, 190 million. UK, 62 million. Netherlands, 17 million.

Sunday, September 4, 11

OKAY, LETS RULE THE WORLDSUPPORT ALL LOCALES!

Sunday, September 4, 11

NOT THAT EASY!

Countries in the world (249)

Languages in the world (6,309)

+ variants

http://en.wikipedia.org/wiki/Lists_of_languages

http://en.wikipedia.org/wiki/Lists_of_countries_and_territories

Sunday, September 4, 11

FEEL AT HOME

Small changes, big impact

Sunday, September 4, 11

PERSONAL NAMES AROUND THE WORLD

Björk Guðmundsdóttir (Icelandic)

Isa bin Osman (Malay)

John Quincy Adams

Sunday, September 4, 11

PERSONAL NAMES AROUND THE WORLD

http://www.w3.org/International/questions/qa-personal-names

First name Middle name Last nameRenan Gonçalves Cardoso de Lima

First name Last nameRenan Gonçalves Cardoso de Lima

Initials Between names Last nameR. G. C. de Lima

Sunday, September 4, 11

PERSONAL NAMES AROUND THE WORLD

Full nameRenan Gonçalves Cardoso de Lima

What should we call you?Renan

Sunday, September 4, 11

PERSONAL NAMES AROUND THE WORLD

Björk Guðmundsdóttir (Icelandic)

Ms. Björk or Ms. Björk Guðmundsdóttir

Isa bin Osman (Malay)

Mr. Isa

John Quincy Adams

Mr. Adams

Sunday, September 4, 11

HOW?

Sunday, September 4, 11

PROBLEMS

The context can change

Hard to find exactly what you want

Hard to know what it means

Sunday, September 4, 11

PLURAL

https://developer.mozilla.org/en/Localization_and_Plurals

Sunday, September 4, 11

CAKEPHP WAY

Using i18n and L10n libraries

Using Translate Behavior

Sunday, September 4, 11

I18N

Others functions: __d(), __dn(), __dc(), __dcn(), __c()http://book.cakephp.org/view/1229/Internationalizing-Your-Application

Sunday, September 4, 11

I18N

$ cake i18n extract

Locale/default.pot

#: FileName.php:lineNumbermsgid "Welcome to our application!"msgstr ""

#: FileName.php:lineNumbermsgid "You have %d item in your basket."msgid_plural "You have %d items in your basket."msgstr[0] ""msgstr[1] ""

Sunday, September 4, 11

POEDIT

Sunday, September 4, 11

I18N

Sunday, September 4, 11

TRANSLATE BEHAVIOR

Sunday, September 4, 11

TRANSLATE BEHAVIOR

Sunday, September 4, 11

L10N

Manage the locales

Identify the locale

Sunday, September 4, 11

L10N

Request

HTTP_ACCEPT_LANGUAGE

IP to country (GeoIP Lite)

URL parameter

book.cakephp.org/pt

URL

book.cakephp.jp

Sunday, September 4, 11

GOODIES

Localized plugin

Localized validation

https://github.com/cakephp/localized

Sunday, September 4, 11

TROUBLESHOOTING

Right encoding

unicode

html metatag

database charset

file charset

Configure::write(‘App.encoding’, ‘UTF-8’);

Sunday, September 4, 11

QUESTIONS?

Sunday, September 4, 11

THANK YOU!

renan.saddam@cakephp.org

@renan_saddam on twitter and #cakephp

http://github.com/renansaddam

Sunday, September 4, 11