Share
Embed
Transcript
85 slides
-
G11N > I18N > L10N > T8N G11N > I18N
> L10N > T8N Globaliza on Interna onaliza on Localiza on Transla on There all numeronyms. I hope you learned something today! -
GLOBALIZATION GLOBALIZATION The term Globaliza on(g11n) comes into play when
a company wants to expand their market outside of their locale place and move into a global market.Globaliza on is simply the umbrella term used to describe the process of bringing i18n and l10n into your product. Vivek Madurai -
INTERNATIONALIZATION INTERNATIONALIZATION To put it in simple words Interna onaliza
on is a process of designing and developing a product so that it can be easily localized for various target markets without any engineering dependency. For example, taking decision on encoding characters stored in your database in Unicode like u -8 instead of la n-1, moving messages to resources files, handling mestamps across mezones Vivek Madurai -
LOCALIZATION LOCALIZATION The term Localiza on refers to the adop
on of a product to a specific language or culture(country/region). Localizing a product includes language transla on, number forma ng, date formats, currency, look and feel etc. Vivek Madurai -
TRANSLATION TRANSLATION translate('a_beer_please', 'en'); // A beer please translate('a_beer_please', 'fr');
// Une bière s'il vous plaît translate('a_beer_please', 'ar'); // ﺖﺤﻤﺳ ﻮﻟ ةﺮﻴﺑ translate('a_beer_please', 'ta'); // தய ெசய் ஒ பீர் -
PLURAL? PLURAL? if (0 === $beers) { translate('no_beer', 'fr'); //
Je n'ai pas bu de bière } elseif (1 === $beers) { translate('one_beer', 'fr'); // J'ai bu une bière } else { translate('more_beer', 'fr'); // J'ai bu plusieurs bières } -
GENDER? GENDER? if ('female' === $gender) { translate('women_drink', 'fr'); //
C'est une grosse buveuse. } elseif ('male' === $gender) { translate('men_drink', 'fr'); // C'est un gros buveur. } -
COMBINED? COMBINED? if ('female' === $gender) { if (0 ===
$beers) { translate('women_no_beer', 'fr'); // Elle n'a pas bu de bière } elseif (1 === $beers) { translate('women_one_beer', 'fr'); // Elle a bu une bière } else { translate('women_more_beer', 'fr'); // Elle a bu plusieurs bières } } elseif ('male' === $gender) { if (0 === $beers) { translate('men_no_beer', 'fr'); // Il n'a pas bu de bière } elseif (1 === $beers) { translate('men_one_beer', 'fr'); // Il a bu une bière } else { translate('men_more_beer', 'fr'); // Il a bu plusieurs bières } } -
MOST SIMPLE EXAMPLE MOST SIMPLE EXAMPLE translate('drink_beer', [ 'name' =>
'Michèle', ]); {name} boit de la bière. -
PLURAL EXAMPLE PLURAL EXAMPLE translate('drink_beer', [ 'beers' => 5, ]);
{beers, plural, =0 {Je n'ai pas bu de bière.} one {J'ai bu une bière.} other {J'ai bu # bières !} } -
GENDER EXAMPLE GENDER EXAMPLE translate('drink_beer', [ 'gender' => 'female', ]);
{gender, select, female {Tu es une grosse buveuse!} male {Tu es un gros buveur!} other {Tu bois beaucoup!} } -
COMBINING VARIABLES COMBINING VARIABLES translate('drink_a_lot', [ 'firstname' => 'Michèle', 'gender'
=> 'female', 'count' => 5, ]); -
ICU HELL! ICU HELL! Doc: More examples: Online editor: {gender,
select, female { {count, plural, =0 {{firstname} ne boit pas.} =1 {{firstname} n'est pas une grosse buveuse, elle n'a bu qu'une seule bière.} other {{firstname} est une grosse buveuse, elle a bu {count} bières!}}} male { {count, plural, =0 {{firstname} ne boit pas.} =1 {{firstname} n'est pas un gros buveur, il n'a bu qu'une seule bière.} other {{firstname} est un gros buveur, il a bu {count} bières!}}} other { {count, plural, =0 {{firstname} ne boit pas.} one {{firstname} a bu une seule bière.} other {{firstname} a bu {count} bières!}}}} h p:/ /userguide.icu-project.org/formatparse/messages h ps:/ /symfony.com/doc/current/transla on/message_format.html h ps:/ /format-message.github.io/icu-message-format-for- translators/editor.html -
TIP: USE A TRANSLATION KEY! TIP: USE A TRANSLATION KEY!
h ps:/ /symfony.com/doc/current/best_prac ces.html#use-keys-for-transla ons-instead- of-content-strings h ps:/ /php-transla on.readthedocs.io/en/latest/best-prac ce/index.html -
PROBLEM #2 PROBLEM #2 THE FILE BASED WORFLOW THE FILE
BASED WORFLOW -
FILE BASED WORKFLOW FILE BASED WORKFLOW 1. Developers create a
transla on file. -
FILE BASED WORKFLOW FILE BASED WORKFLOW 1. Developers create a
transla on file. 2. This file is sent to translators. -
FILE BASED WORKFLOW FILE BASED WORKFLOW 1. Developers create a
transla on file. 2. This file is sent to translators. 3. Translators send back a translated file. -
FILE BASED WORKFLOW FILE BASED WORKFLOW 1. Developers create a
transla on file. 2. This file is sent to translators. 3. Translators send back a translated file. 4. Developers integrate this file in applica on. -
FILE BASED WORKFLOW FILE BASED WORKFLOW 1. Developers create a
transla on file. 2. This file is sent to translators. 3. Translators send back a translated file. 4. Developers integrate this file in applica on. 5. REPEAT -
WORKFLOW - 2 LOCALES WORKFLOW - 2 LOCALES Developer Translation
file Keys Create Translators EN FR ... Translated file Pull -
WORKFLOW - 3 LOCALES WORKFLOW - 3 LOCALES Developer Translation
file Keys Create Translators EN FR ES ... Translated file Pull -
WORKFLOW - 4 LOCALES WORKFLOW - 4 LOCALES Developer Translation
file Keys Create Translators EN FR ES CO ... Translated file Pull -
WORKFLOW - 5 LOCALES WORKFLOW - 5 LOCALES Developer Translation
file Keys Create Translators EN FR ES CO AR ... Translated file Pull -
FAR FROM PERFECT FAR FROM PERFECT 1. Time consuming for
developer 2. Complicated workflow -
FAR FROM PERFECT FAR FROM PERFECT 1. Time consuming for
developer 2. Complicated workflow 3. Hard to deal with diff. -
☺ ☺ SOLUTION SOLUTION USE A SAAS PRODUCT USE A
SAAS PRODUCT -
LOT OF SOLUTION EXISTS LOT OF SOLUTION EXISTS Loco (h
ps:/ /localise.biz/) PhraseApp Transifex ... (please don't reinvent the wheel) -
LOT OF SOLUTION EXISTS LOT OF SOLUTION EXISTS Loco (h
ps:/ /localise.biz/) PhraseApp Transifex ... (please don't reinvent the wheel) -
IT SOLVES OUR PROBLEMS (& EVEN MORE) IT SOLVES OUR
PROBLEMS (& EVEN MORE) -
IT SOLVES OUR PROBLEMS (& EVEN MORE) IT SOLVES OUR
PROBLEMS (& EVEN MORE) Developer only have to push keys, nothing else. -
IT SOLVES OUR PROBLEMS (& EVEN MORE) IT SOLVES OUR
PROBLEMS (& EVEN MORE) Developer only have to push keys, nothing else. Translators now have a dedicated tool. -
IT SOLVES OUR PROBLEMS (& EVEN MORE) IT SOLVES OUR
PROBLEMS (& EVEN MORE) Developer only have to push keys, nothing else. Translators now have a dedicated tool. SAAS product = primary data store -
IT SOLVES OUR PROBLEMS (& EVEN MORE) IT SOLVES OUR
PROBLEMS (& EVEN MORE) Developer only have to push keys, nothing else. Translators now have a dedicated tool. SAAS product = primary data store You have access to the whole history! \o/ -
IT SOLVES OUR PROBLEMS (& EVEN MORE) IT SOLVES OUR
PROBLEMS (& EVEN MORE) Developer only have to push keys, nothing else. Translators now have a dedicated tool. SAAS product = primary data store You have access to the whole history! \o/ You can add context to transla ons \o/ -
IT SOLVES OUR PROBLEMS (& EVEN MORE) IT SOLVES OUR
PROBLEMS (& EVEN MORE) Developer only have to push keys, nothing else. Translators now have a dedicated tool. SAAS product = primary data store You have access to the whole history! \o/ You can add context to transla ons \o/ ⬇ Automa cally retrieve transla ons during deploy -
SYMFONY COMPONENT FTW! SYMFONY COMPONENT FTW! composer require symfony/translation use
Symfony\Component\Translation\Translator; $translator = new Translator('fr_FR'); $translator->addResource('array', [ 'a_beer_please' => 'Une bière s\'il vous plaît', ], 'fr_FR'); echo $translator->trans('a_beer_please'); // « Une bière s'il vous plaît » -
SYMFONY/TRANSLATION SYMFONY/TRANSLATION Supports variables Supports ICU Supports Fallback Supports catalogs
Provide basic extract feature -
WE'RE MISSING SOMETHING WE'RE MISSING SOMETHING HOW TO SYNC TRANSLATIONS
WITH A SAAS SOLUTION? HOW TO SYNC TRANSLATIONS WITH A SAAS SOLUTION? -
PHP-TRANSLATION FTW PHP-TRANSLATION FTW A github organisa on dedicated to
transla ons Allow to sync transla ons with SAAS solu ons ⬇ Provide advanced extract feature Doc: h ps:/ /php-transla on.readthedocs.io/en/latest/ -
& MUCH MORE! & MUCH MORE! ✍ Edit in place
Web UI Auto translate -
WHO WORK ON A MONOLINGUAL APP? WHO WORK ON A
MONOLINGUAL APP? -
WHO WORK ON A MONOLINGUAL APP? WHO WORK ON A
MONOLINGUAL APP? WITHOUT TRANSLATIONS? WITHOUT TRANSLATIONS? -
"Can you change the transla on in the footer please?"
"There's a typo in the subscrip on funnel, could you correct it?" -
➕ Create a PR git commit -m 'Correct typo translation'
git push origin fix-typo -
➕ Create a PR ⏲ Wait for tests git commit
-m 'Correct typo translation' git push origin fix-typo -
➕ Create a PR ⏲ Wait for tests ⏲ Wait
for review git commit -m 'Correct typo translation' git push origin fix-typo -
➕ Create a PR ⏲ Wait for tests ⏲ Wait
for review ⏲ Merge your PR git commit -m 'Correct typo translation' git push origin fix-typo -
➕ Create a PR ⏲ Wait for tests ⏲ Wait
for review ⏲ Merge your PR Deploy git commit -m 'Correct typo translation' git push origin fix-typo -
➕ Create a PR ⏲ Wait for tests ⏲ Wait
for review ⏲ Merge your PR Deploy And some mes, there is an issue to deal with... git commit -m 'Correct typo translation' git push origin fix-typo -
SET UP A TRANSLATION WORKFLOW! SET UP A TRANSLATION WORKFLOW!
Devs are not blockers / bored anymore. -
SET UP A TRANSLATION WORKFLOW! SET UP A TRANSLATION WORKFLOW!
Devs are not blockers / bored anymore. It's easier / quicker for anyone to update transla ons. -
SET UP A TRANSLATION WORKFLOW! SET UP A TRANSLATION WORKFLOW!
Devs are not blockers / bored anymore. It's easier / quicker for anyone to update transla ons. It's a first step done for G11N.