Entschuldigen you, parlez vouz JavaScript?*

*Worst title ever

Me

  • Sebastian Golasch
  • @asciidisco GitHub/Twitter
  • Cologne/Germany
  • denkwerk.com
  • JavaScript Developer

WARNING

This Talk covers the i18n problem in a very pragmatic way. If you have questions regarding UTF-WHATEVER, I suggest to ask some random C programmer!

The Rocky Road to i18n

MESSAGES

DATES

NUMBERS

CURRENCY

AND PROBABLY A GAZILLION THINGS YOU NEVER THOUGHT OF!

A Few Examples:

EASY?

She looks so good!
Sie sieht so gut aus!

WHAT IF?

He looks so good!
Er sieht so gut aus!

Gender anyone?!

EASY?

You got 4 new Messages!
Du hast 4 neue Nachrichten!

WHAT IF?

You got 1 new Message!
Du hast 1 neue Nachricht!

Singular/Plural anyone?!

EASY?

Current Date: 11/16/2012
Aktuelles Datum: 16.11.2012

WHAT IF?

Hi, it is saturday the 16th of November
Hallo, es ist Samstag der 16. November

Dates (HORROR!) anyone?!

EASY?

Wow, he got elected with 70.45% of the votes!
Wow, er wurde mit 70,45% der Stimmen gewählt!

WHAT IF?

Wow, he got elected with 70.45% (avg of 1,234.57 votes per district) of the votes!
Wow, er wurde mit 70,45% (durschnittlich 1.234,57 Stimmen pro Bezirk) der Stimmen gewählt!

NUMBERS anyone?!

EASY?

The shirts costs around 10$!
Das T-Shirt kostet zirka 10€!

CURRENCY anyone?!

You will so love the next one ;)

Hi ${USERNAME} you have added 5 friends to 3 boards. Last change: 11/12/2012 at 5:03 pm.


Hallo ${USERNAME} du hast 5 Freunde zu 3 Themen hinzugefügt. Letzte Änderung: 12.11.2012 um 17:03.

The Tools

ICU Messageformat

How to use?

$ npm install messageformat -g
$ messageformat -l de [myFolderWithLanguageFiles]
// date.json
{
	"simple": "Current Date: {DATE}",
	"adv": "Hi, it is {DAY_NAME} the {DAY} of {MONTH}"
}
<script src="en/i18n.js"></script>
window.i18n['date'].simple({DATE: '2012-06-08'});

jQuery Globalize

How to use?

<script src="globalize.js"></script>
<script src="culture/globalize.culture.fr.js"></script>
Globalize.culture('fr');
Globalize.format(value, format);

RECAP

This is the best we can get today!

Disagree?!

Then go out & help the guys!

Links, Links, Links

Questions? Thx!

@asciidisco / denkwerk.com