internationalizing your application

35
INTERNATIONALIZING YOUR APPLICATION by Renan Gonçalves S Sunday, September 4, 11

Upload: renan-goncalves

Post on 20-Jun-2015

1.883 views

Category:

Technology


0 download

DESCRIPTION

Talk presented at CakeFest 2011, in Manchester-UK.

TRANSCRIPT

Page 1: Internationalizing your application

INTERNATIONALIZING YOUR APPLICATION

by Renan Gonçalves

S

Sunday, September 4, 11

Page 2: Internationalizing your application

WHO IS THIS GUY?

Software Engineer

TrueServer B.V.

CakePHP since 2007

Contributing since 2008

Brazilian

Sunday, September 4, 11

Page 3: Internationalizing your application

LOCALIZATION

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

Locale defines:

User’s language

Country

Sunday, September 4, 11

Page 4: Internationalizing your application

LOCALE

en

en_US

cs_CZ.UTF-8

pt_BR@CE

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

Sunday, September 4, 11

Page 5: Internationalizing your application

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

Page 6: Internationalizing your application

INTERNATIONALIZATION

Supporting international data

Text Content

Numbers

Currencies

Dates / Times

Calendars

Sunday, September 4, 11

Page 7: Internationalizing your application

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

Page 8: Internationalizing your application

WRITING CONVENTIONS

Date/time format

Different calendars

Time zones

Number formatting

Difference in symbols

Sunday, September 4, 11

Page 9: Internationalizing your application

CULTURE

Sunday, September 4, 11

Page 10: Internationalizing your application

CULTURE

Images and colors

Telephone numbers

Currency

Symbols, format

Weights and measures

Government assigned numbers

Sunday, September 4, 11

Page 11: Internationalizing your application

OTHERS

National variants of languages

Local content

Order of sorting (collation)

Sunday, September 4, 11

Page 12: Internationalizing your application

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

Page 13: Internationalizing your application

OKAY, LETS RULE THE WORLDSUPPORT ALL LOCALES!

Sunday, September 4, 11

Page 14: Internationalizing your application

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

Page 15: Internationalizing your application

FEEL AT HOME

Small changes, big impact

Sunday, September 4, 11

Page 16: Internationalizing your application

PERSONAL NAMES AROUND THE WORLD

Björk Guðmundsdóttir (Icelandic)

Isa bin Osman (Malay)

John Quincy Adams

Sunday, September 4, 11

Page 17: Internationalizing your application

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

Page 18: Internationalizing your application

PERSONAL NAMES AROUND THE WORLD

Full nameRenan Gonçalves Cardoso de Lima

What should we call you?Renan

Sunday, September 4, 11

Page 19: Internationalizing your application

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

Page 20: Internationalizing your application

HOW?

Sunday, September 4, 11

Page 21: Internationalizing your application

PROBLEMS

The context can change

Hard to find exactly what you want

Hard to know what it means

Sunday, September 4, 11

Page 22: Internationalizing your application

PLURAL

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

Sunday, September 4, 11

Page 23: Internationalizing your application

CAKEPHP WAY

Using i18n and L10n libraries

Using Translate Behavior

Sunday, September 4, 11

Page 24: Internationalizing your application

I18N

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

Sunday, September 4, 11

Page 25: Internationalizing your application

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

Page 26: Internationalizing your application

POEDIT

Sunday, September 4, 11

Page 27: Internationalizing your application

I18N

Sunday, September 4, 11

Page 28: Internationalizing your application

TRANSLATE BEHAVIOR

Sunday, September 4, 11

Page 29: Internationalizing your application

TRANSLATE BEHAVIOR

Sunday, September 4, 11

Page 30: Internationalizing your application

L10N

Manage the locales

Identify the locale

Sunday, September 4, 11

Page 31: Internationalizing your application

L10N

Request

HTTP_ACCEPT_LANGUAGE

IP to country (GeoIP Lite)

URL parameter

book.cakephp.org/pt

URL

book.cakephp.jp

Sunday, September 4, 11

Page 32: Internationalizing your application

GOODIES

Localized plugin

Localized validation

https://github.com/cakephp/localized

Sunday, September 4, 11

Page 33: Internationalizing your application

TROUBLESHOOTING

Right encoding

unicode

html metatag

database charset

file charset

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

Sunday, September 4, 11

Page 34: Internationalizing your application

QUESTIONS?

Sunday, September 4, 11

Page 35: Internationalizing your application

THANK YOU!

[email protected]

@renan_saddam on twitter and #cakephp

http://github.com/renansaddam

Sunday, September 4, 11