SlideShare una empresa de Scribd logo
1 de 27
i18n and L10n
in TYPO3 Flow
    Karsten Dambekalns




                         Inspiring people to
                         share
Karsten Dambekalns
co-lead of TYPO3 Neos and Flow
35 years old
lives in Lübeck, Germany
1 wife, 3 sons, 1 espresso machine
likes canoeing and climbing




                                     Inspiring people to
                                     share
Basics
 i18n is the process of making software
 localizable
 L10n means actually

 • formatting dates, numbers, …
 • translating text
 • adjusting other things (images, …)

                                Inspiring people to
                                share
Locale
 Locale instances encapsulate a locale
 identifier
 Locales define the language and formats
 to use
 Locales form a hierarchy

 • en is a parent of en_US which is a
   parent of en_US_POSIX

 • Thus items for the en_US locale that do
                                  Inspiring people to
                                 share
What you need
 A way to translate in templates
 A way to store translations of labels
 Formatters for dates, numbers, …
 An API for use in PHP




                                   Inspiring people to
                                   share
f:translate
     the way of translating you will use most

<f:translate id="my.label.1"/>

{f:translate(id: 'my.label.1')}

     translation by label is possible, but
     discouraged
   • less reliable than id-based translation
                                       Inspiring people to
                                       share
f:translate
<f:translate id="my.label.1"
 source="Registration"
 package="Acme.Demo"/>

<f:translate id="my.label.1"
  arguments="{0: 'hi'}" quantity="2"/>



                                         Inspiring people to
                                         share
f:form.select
    has translation support built in

<f:form.select options="{paymentOptions}"
translate="{by: 'id'}" />

<f:form.select options="{paymentOptions}"
translate="{by: 'id', prefix: 'payment.options.',
package: 'Acme.Demo.Translations'}" />


                                         Inspiring people to
                                         share
Message catalogs
 XML Localisation Interchange File Format
 is the standard we use
 Looked up in well-known location
 Resources/
   Private/
     Translations/
       <locale>/
        <source>.xlf


                                Inspiring people to
                                share
XLIFF basics
 An XLIFF file can hold translations for one
 locale
 It contains one or more <file> elements
 corresponding to a source
 Localizable data is stored in <trans-unit>
 elements which contain a
 <source> element to store the source
 text and a (non-mandatory) <target>


                                 Inspiring people to
                                 share
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
	

 <file original="" product-name="Acme.Demo" source-
language="en" datatype="plaintext">
	

 	

 <body>
                                Text
	

 	

 	

 <trans-unit id="my.label.1" xml:space="preserve">
                                 Text
	

 	

 	

 	

 <source>My Label 1</source>
	

 	

 	

 </trans-unit>
	

 	

 </body>
	

 </file>
</xliff>



                                                   Inspiring people to
                                                   share
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
	

 <file original="" product-name="Acme.Demo" source-
language="en" datatype="plaintext">
	

 	

 <body>
	

 	

 	

 <trans-unit id="my.label.1" xml:space="preserve">
	

 	

 	

 	

 <source>My Label 1</source>
	

 	

 	

 	

 <target>Mein Aufkleber 1</target>
	

 	

 	

 </trans-unit>
	

 	

 </body>
	

 </file>
</xliff>


                                                   Inspiring people to
                                                   share
i18n configuration
       Default locale can be set in Settings.yaml
       Locale fallback rules are configurable

TYPO3:
 Flow:
  i18n:
    defaultLocale: de
    fallbackRule:
      strict: FALSE
      order: [lv, en]


                                        Inspiring people to
                                        share
i18n configuration
       Default locale can be set in Settings.yaml
       Locale fallback rules are configurable

TYPO3:
 Flow:
  i18n:
    defaultLocale: de
    fallbackRule:
      strict: FALSE
      order: [lv, en]


                                        Inspiring people to
                                        share
Placeholder use
$this->view->assign('foo', 'QUUX');
$this->view->assign('bar', 'BAZ');


<f:translate id="my.label.3" arguments="{0: foo, 1: bar}"/>


<trans-unit id="my.label.3" xml:space="preserve">
	

 <source>I have {0} and {1}</source>
	

 <target>{1} habe ich und {0} habe ich auch</target>
</trans-unit>


                                                     Inspiring people to
                                                     share
String placeholders                        * will be available with Flow 2.0



$this->view->assign('foo', 'QUUX');
$this->view->assign('bar', 'BAZ');


<f:translate id="my.label.3" arguments="{'some': foo, 'thing': bar}"/>


<trans-unit id="my.label.3" xml:space="preserve">
	

 <source>I have {some} and {thing}</source>
	

 <target>{thing} habe ich und {some} habe ich auch</target>
</trans-unit>


                                                         Inspiring people to
                                                         share
Using formatters
$this->view->assign('currentDateAndTime', new DateTime());
$this->view->assign('currentCost', 1.25);


<f:translate id="my.label.4" arguments="{
   0: currentDateAndTime, 1: currentCost
}"/>


<source>
  At {0,datetime} it costs {1,number} monetary units
</source>

                                                  Inspiring people to
                                                  share
Plural forms
 The CLDR defines six plural forms

 • zero, one, two, few, many, other
 Different languages use more or less
 forms

 • singular and plurals for English
 • one, few and other for Polish
 • only other for Japanese
                                  Inspiring people to
                                  share
Plural forms
<f:translate id="my.label.6" quantity="{quarks->f:count()}"/>


<group id="my.label.6" restype="x-gettext-plurals">
	

 <trans-unit id="my.label.6[0]" xml:space="preserve">
   	

  <source>There is this quark</source>
	

 </trans-unit>
	

 <trans-unit id="my.label.6[1]" xml:space="preserve">
	

 	

 <source>There are these quarks</source>
	

 </trans-unit>
</group>


                                                    Inspiring people to
                                                    share
L10n of resources
 Resources can be localized as well
 The locale is part of the name

 • Image.png
 • Image.de.png
 • Image.lv.png
 Usable for all resources

 • Images, templates, …
                                  Inspiring people to
                                  share
f:resource
         uses localized resources by default*

     <img src="{f:uri.resource(path: 'Images/Image.png')}"/>

     <img src="../../../../Resources/Public/Images/Image.png"/>




* see Known

                                                  Inspiring people to
                                                  share
i18n in PHP code
 TYPO3FlowI18nTranslator

 • translateById()
 • translateByOriginalLabel()
 TYPO3FlowI18nService

 • getConfiguration()
 • getLocalizedFilename()
 TYPO3FlowI18nFormatter*

                                Inspiring people to
                                share
Setting current locale
/**
   * @param string $locale
   * @return void
   */
public function selectAction($locale = NULL) {
	

 if ($locale !== NULL) {
	

 	

 $this->i18nService->getConfiguration()->setCurrentLocale(
     	

 	

 new TYPO3FlowI18nLocale($locale)
	

 	

 );
	

 }                                             WARN   ING:
	

 $this->forward('index');                        Stupid
}
                                                    ex ample
                                                 Inspiring people to
                                                 share
Tips & Tricks
 Split catalogs at logical points
 Try to use.a.clever.id.system
 Avoid hardcoded labels from the start
 To change "original" labels simply
 translate to "original" language




                                    Inspiring people to
                                    share
Known issues
 L10n support in f:resource VH pending in
 review
 Fallback per label is missing, currently
 only done per catalog
 Overriding parts of catalogs is missing
 Model translation still missing




                                   Inspiring people to
                                   share
Thank You!
 These slides can be found at:
 http://speakerdeck.com/kdambekalns
 http://slideshare.net/kfish
 Give me feedback:
 karsten@typo3.org | karsten@dambekalns.de
 Download Flow: http://flow.typo3.org
 Follow me on twitter: @kdambekalns
 Support me using


                                  Inspiring people to
                                  share
i18n and L10n in TYPO3 Flow

Más contenido relacionado

La actualidad más candente

La actualidad más candente (19)

PHP
PHP PHP
PHP
 
perl usage at database applications
perl usage at database applicationsperl usage at database applications
perl usage at database applications
 
Introduction to perl_ a scripting language
Introduction to perl_ a scripting languageIntroduction to perl_ a scripting language
Introduction to perl_ a scripting language
 
Introduction To Php For Wit2009
Introduction To Php For Wit2009Introduction To Php For Wit2009
Introduction To Php For Wit2009
 
PHP Powerpoint -- Teach PHP with this
PHP Powerpoint -- Teach PHP with thisPHP Powerpoint -- Teach PHP with this
PHP Powerpoint -- Teach PHP with this
 
Php Simple Xml
Php Simple XmlPhp Simple Xml
Php Simple Xml
 
Puppet Camp Berlin 2015: Martin Alfke | The Power of Puppet 4
Puppet Camp Berlin 2015: Martin Alfke | The Power of Puppet 4Puppet Camp Berlin 2015: Martin Alfke | The Power of Puppet 4
Puppet Camp Berlin 2015: Martin Alfke | The Power of Puppet 4
 
Perl
PerlPerl
Perl
 
Perl tutorial
Perl tutorialPerl tutorial
Perl tutorial
 
PHP - Introduction to PHP
PHP -  Introduction to PHPPHP -  Introduction to PHP
PHP - Introduction to PHP
 
DBIx::Class beginners
DBIx::Class beginnersDBIx::Class beginners
DBIx::Class beginners
 
Further Php
Further PhpFurther Php
Further Php
 
Perl
PerlPerl
Perl
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Was können wir von Rebol lernen?
Was können wir von Rebol lernen?Was können wir von Rebol lernen?
Was können wir von Rebol lernen?
 
DBIx::Class introduction - 2010
DBIx::Class introduction - 2010DBIx::Class introduction - 2010
DBIx::Class introduction - 2010
 
My cool new Slideshow!
My cool new Slideshow!My cool new Slideshow!
My cool new Slideshow!
 
slidesharenew1
slidesharenew1slidesharenew1
slidesharenew1
 

Destacado

Emplois du Temps du 2ème semestre 2016-2017
Emplois du Temps du 2ème semestre 2016-2017Emplois du Temps du 2ème semestre 2016-2017
Emplois du Temps du 2ème semestre 2016-2017Mohamed Larbi BEN YOUNES
 
April 19 social marketing & yr business
April 19 social marketing & yr businessApril 19 social marketing & yr business
April 19 social marketing & yr businessHack the Hood
 
My Works About UT Plan (draft) 2004
My Works About UT Plan (draft) 2004My Works About UT Plan (draft) 2004
My Works About UT Plan (draft) 2004Ruby Kuo
 
4.3 My Works About Operation
4.3 My Works About Operation4.3 My Works About Operation
4.3 My Works About OperationRuby Kuo
 
Presentation
PresentationPresentation
Presentationjordi
 
A review of Office AutoPilot
A review of Office AutoPilotA review of Office AutoPilot
A review of Office AutoPilotE-Web Marketing
 
080312 talk about 3D-Internet Overview
080312 talk about 3D-Internet Overview080312 talk about 3D-Internet Overview
080312 talk about 3D-Internet OverviewKohei Nishikawa
 
Qwerly GeeknRolla Presentation
Qwerly GeeknRolla PresentationQwerly GeeknRolla Presentation
Qwerly GeeknRolla PresentationMax Niederhofer
 
Filosofia da educação uma abordagem sobre fundamentos da educação no brasil
Filosofia da educação   uma abordagem sobre fundamentos da educação no brasilFilosofia da educação   uma abordagem sobre fundamentos da educação no brasil
Filosofia da educação uma abordagem sobre fundamentos da educação no brasilsammyfreitas
 
Hex Colors At A Glance
Hex Colors At A GlanceHex Colors At A Glance
Hex Colors At A GlanceDino Baskovic
 
What can I do?
What can I do?What can I do?
What can I do?Martin Tae
 
The Augmented Reality industry in 15 min.
The Augmented Reality industry in 15 min.The Augmented Reality industry in 15 min.
The Augmented Reality industry in 15 min.wimvermeulen
 
SoftLayerで始めるデジタルマーケティング
SoftLayerで始めるデジタルマーケティングSoftLayerで始めるデジタルマーケティング
SoftLayerで始めるデジタルマーケティングKohei Nishikawa
 
A Content Repository for TYPO3 5.0
A Content Repository for TYPO3 5.0A Content Repository for TYPO3 5.0
A Content Repository for TYPO3 5.0Karsten Dambekalns
 
Kcic boot camp oct 2011 idea to implementation 2011
Kcic boot camp oct 2011 idea to implementation 2011Kcic boot camp oct 2011 idea to implementation 2011
Kcic boot camp oct 2011 idea to implementation 2011Hack the Hood
 
Do The Adverts Fool Us
Do The Adverts Fool UsDo The Adverts Fool Us
Do The Adverts Fool Usjordi
 

Destacado (20)

Emplois du Temps du 2ème semestre 2016-2017
Emplois du Temps du 2ème semestre 2016-2017Emplois du Temps du 2ème semestre 2016-2017
Emplois du Temps du 2ème semestre 2016-2017
 
April 19 social marketing & yr business
April 19 social marketing & yr businessApril 19 social marketing & yr business
April 19 social marketing & yr business
 
My Works About UT Plan (draft) 2004
My Works About UT Plan (draft) 2004My Works About UT Plan (draft) 2004
My Works About UT Plan (draft) 2004
 
4.3 My Works About Operation
4.3 My Works About Operation4.3 My Works About Operation
4.3 My Works About Operation
 
Presentation
PresentationPresentation
Presentation
 
GlobalSHIFT 3.0
GlobalSHIFT 3.0GlobalSHIFT 3.0
GlobalSHIFT 3.0
 
A review of Office AutoPilot
A review of Office AutoPilotA review of Office AutoPilot
A review of Office AutoPilot
 
I Jet Exec Sum
I  Jet Exec SumI  Jet Exec Sum
I Jet Exec Sum
 
080312 talk about 3D-Internet Overview
080312 talk about 3D-Internet Overview080312 talk about 3D-Internet Overview
080312 talk about 3D-Internet Overview
 
Qwerly GeeknRolla Presentation
Qwerly GeeknRolla PresentationQwerly GeeknRolla Presentation
Qwerly GeeknRolla Presentation
 
Filosofia da educação uma abordagem sobre fundamentos da educação no brasil
Filosofia da educação   uma abordagem sobre fundamentos da educação no brasilFilosofia da educação   uma abordagem sobre fundamentos da educação no brasil
Filosofia da educação uma abordagem sobre fundamentos da educação no brasil
 
Hex Colors At A Glance
Hex Colors At A GlanceHex Colors At A Glance
Hex Colors At A Glance
 
What can I do?
What can I do?What can I do?
What can I do?
 
The Augmented Reality industry in 15 min.
The Augmented Reality industry in 15 min.The Augmented Reality industry in 15 min.
The Augmented Reality industry in 15 min.
 
SoftLayerで始めるデジタルマーケティング
SoftLayerで始めるデジタルマーケティングSoftLayerで始めるデジタルマーケティング
SoftLayerで始めるデジタルマーケティング
 
A Content Repository for TYPO3 5.0
A Content Repository for TYPO3 5.0A Content Repository for TYPO3 5.0
A Content Repository for TYPO3 5.0
 
Kcic boot camp oct 2011 idea to implementation 2011
Kcic boot camp oct 2011 idea to implementation 2011Kcic boot camp oct 2011 idea to implementation 2011
Kcic boot camp oct 2011 idea to implementation 2011
 
Gabriela
GabrielaGabriela
Gabriela
 
Moscow 09 12-11
Moscow 09 12-11Moscow 09 12-11
Moscow 09 12-11
 
Do The Adverts Fool Us
Do The Adverts Fool UsDo The Adverts Fool Us
Do The Adverts Fool Us
 

Similar a i18n and L10n in TYPO3 Flow

Filesystems Lisbon 2018
Filesystems Lisbon 2018Filesystems Lisbon 2018
Filesystems Lisbon 2018Frank de Jonge
 
How to make multilingual plugins and themes
How to make multilingual plugins and themesHow to make multilingual plugins and themes
How to make multilingual plugins and themesjohnpbloch
 
Advanced Internationalization with Rails
Advanced Internationalization with RailsAdvanced Internationalization with Rails
Advanced Internationalization with RailsClinton Dreisbach
 
Bioinformatics p5-bioperl v2013-wim_vancriekinge
Bioinformatics p5-bioperl v2013-wim_vancriekingeBioinformatics p5-bioperl v2013-wim_vancriekinge
Bioinformatics p5-bioperl v2013-wim_vancriekingeProf. Wim Van Criekinge
 
WordPress Plugin Localization
WordPress Plugin LocalizationWordPress Plugin Localization
WordPress Plugin LocalizationRonald Huereca
 
Solr Application Development Tutorial
Solr Application Development TutorialSolr Application Development Tutorial
Solr Application Development TutorialErik Hatcher
 
Fluent Development with FLOW3
Fluent Development with FLOW3Fluent Development with FLOW3
Fluent Development with FLOW3Robert Lemke
 
Aidan's PhD Viva
Aidan's PhD VivaAidan's PhD Viva
Aidan's PhD VivaAidan Hogan
 
php fundamental
php fundamentalphp fundamental
php fundamentalzalatarunk
 
Php introduction with history of php
Php introduction with history of phpPhp introduction with history of php
Php introduction with history of phppooja bhandari
 
Tricks in natural language processing
Tricks in natural language processingTricks in natural language processing
Tricks in natural language processingBabu Priyavrat
 

Similar a i18n and L10n in TYPO3 Flow (20)

Schulung Fluid Templating
Schulung Fluid TemplatingSchulung Fluid Templating
Schulung Fluid Templating
 
Python master class part 1
Python master class part 1Python master class part 1
Python master class part 1
 
Filesystems Lisbon 2018
Filesystems Lisbon 2018Filesystems Lisbon 2018
Filesystems Lisbon 2018
 
Bioinformatica p6-bioperl
Bioinformatica p6-bioperlBioinformatica p6-bioperl
Bioinformatica p6-bioperl
 
How to make multilingual plugins and themes
How to make multilingual plugins and themesHow to make multilingual plugins and themes
How to make multilingual plugins and themes
 
Advanced Internationalization with Rails
Advanced Internationalization with RailsAdvanced Internationalization with Rails
Advanced Internationalization with Rails
 
Bioinformatics p5-bioperl v2013-wim_vancriekinge
Bioinformatics p5-bioperl v2013-wim_vancriekingeBioinformatics p5-bioperl v2013-wim_vancriekinge
Bioinformatics p5-bioperl v2013-wim_vancriekinge
 
WordPress Plugin Localization
WordPress Plugin LocalizationWordPress Plugin Localization
WordPress Plugin Localization
 
SHELL PROGRAMMING
SHELL PROGRAMMINGSHELL PROGRAMMING
SHELL PROGRAMMING
 
Tml for Laravel
Tml for LaravelTml for Laravel
Tml for Laravel
 
TYPO3 meets XLIFF + reST
TYPO3 meets XLIFF + reSTTYPO3 meets XLIFF + reST
TYPO3 meets XLIFF + reST
 
Solr Application Development Tutorial
Solr Application Development TutorialSolr Application Development Tutorial
Solr Application Development Tutorial
 
Fluent Development with FLOW3
Fluent Development with FLOW3Fluent Development with FLOW3
Fluent Development with FLOW3
 
Nessus and Reporting Karma
Nessus and Reporting KarmaNessus and Reporting Karma
Nessus and Reporting Karma
 
Aidan's PhD Viva
Aidan's PhD VivaAidan's PhD Viva
Aidan's PhD Viva
 
php fundamental
php fundamentalphp fundamental
php fundamental
 
Php introduction with history of php
Php introduction with history of phpPhp introduction with history of php
Php introduction with history of php
 
php
phpphp
php
 
Tricks in natural language processing
Tricks in natural language processingTricks in natural language processing
Tricks in natural language processing
 
Spsl by sasidhar 3 unit
Spsl by sasidhar  3 unitSpsl by sasidhar  3 unit
Spsl by sasidhar 3 unit
 

Más de Karsten Dambekalns

The Perfect Neos Project Setup
The Perfect Neos Project SetupThe Perfect Neos Project Setup
The Perfect Neos Project SetupKarsten Dambekalns
 
Sawubona! Content Dimensions with Neos
Sawubona! Content Dimensions with NeosSawubona! Content Dimensions with Neos
Sawubona! Content Dimensions with NeosKarsten Dambekalns
 
Deploying TYPO3 Neos websites using Surf
Deploying TYPO3 Neos websites using SurfDeploying TYPO3 Neos websites using Surf
Deploying TYPO3 Neos websites using SurfKarsten Dambekalns
 
Profiling TYPO3 Flow Applications
Profiling TYPO3 Flow ApplicationsProfiling TYPO3 Flow Applications
Profiling TYPO3 Flow ApplicationsKarsten Dambekalns
 
Using Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 FlowUsing Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 FlowKarsten Dambekalns
 
How Git and Gerrit make you more productive
How Git and Gerrit make you more productiveHow Git and Gerrit make you more productive
How Git and Gerrit make you more productiveKarsten Dambekalns
 
The agile future of a ponderous project
The agile future of a ponderous projectThe agile future of a ponderous project
The agile future of a ponderous projectKarsten Dambekalns
 
How Domain-Driven Design helps you to migrate into the future
How Domain-Driven Design helps you to migrate into the futureHow Domain-Driven Design helps you to migrate into the future
How Domain-Driven Design helps you to migrate into the futureKarsten Dambekalns
 
Content Repository, Versioning and Workspaces in TYPO3 Phoenix
Content Repository, Versioning and Workspaces in TYPO3 PhoenixContent Repository, Versioning and Workspaces in TYPO3 Phoenix
Content Repository, Versioning and Workspaces in TYPO3 PhoenixKarsten Dambekalns
 
Transparent Object Persistence (within FLOW3)
Transparent Object Persistence (within FLOW3)Transparent Object Persistence (within FLOW3)
Transparent Object Persistence (within FLOW3)Karsten Dambekalns
 
Transparent Object Persistence with FLOW3
Transparent Object Persistence with FLOW3Transparent Object Persistence with FLOW3
Transparent Object Persistence with FLOW3Karsten Dambekalns
 
Implementing a JSR-283 Content Repository in PHP
Implementing a JSR-283 Content Repository in PHPImplementing a JSR-283 Content Repository in PHP
Implementing a JSR-283 Content Repository in PHPKarsten Dambekalns
 
Knowledge Management in der TYPO3 Community
Knowledge Management in der TYPO3 CommunityKnowledge Management in der TYPO3 Community
Knowledge Management in der TYPO3 CommunityKarsten Dambekalns
 
Implementing a JSR-283 Content Repository in PHP
Implementing a JSR-283 Content Repository in PHPImplementing a JSR-283 Content Repository in PHP
Implementing a JSR-283 Content Repository in PHPKarsten Dambekalns
 
Introduction to Source Code Management
Introduction to Source Code ManagementIntroduction to Source Code Management
Introduction to Source Code ManagementKarsten Dambekalns
 

Más de Karsten Dambekalns (20)

The Perfect Neos Project Setup
The Perfect Neos Project SetupThe Perfect Neos Project Setup
The Perfect Neos Project Setup
 
Sawubona! Content Dimensions with Neos
Sawubona! Content Dimensions with NeosSawubona! Content Dimensions with Neos
Sawubona! Content Dimensions with Neos
 
Deploying TYPO3 Neos websites using Surf
Deploying TYPO3 Neos websites using SurfDeploying TYPO3 Neos websites using Surf
Deploying TYPO3 Neos websites using Surf
 
Profiling TYPO3 Flow Applications
Profiling TYPO3 Flow ApplicationsProfiling TYPO3 Flow Applications
Profiling TYPO3 Flow Applications
 
Using Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 FlowUsing Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 Flow
 
FLOW3-Workshop F3X12
FLOW3-Workshop F3X12FLOW3-Workshop F3X12
FLOW3-Workshop F3X12
 
Doctrine in FLOW3
Doctrine in FLOW3Doctrine in FLOW3
Doctrine in FLOW3
 
How Git and Gerrit make you more productive
How Git and Gerrit make you more productiveHow Git and Gerrit make you more productive
How Git and Gerrit make you more productive
 
The agile future of a ponderous project
The agile future of a ponderous projectThe agile future of a ponderous project
The agile future of a ponderous project
 
How Domain-Driven Design helps you to migrate into the future
How Domain-Driven Design helps you to migrate into the futureHow Domain-Driven Design helps you to migrate into the future
How Domain-Driven Design helps you to migrate into the future
 
Content Repository, Versioning and Workspaces in TYPO3 Phoenix
Content Repository, Versioning and Workspaces in TYPO3 PhoenixContent Repository, Versioning and Workspaces in TYPO3 Phoenix
Content Repository, Versioning and Workspaces in TYPO3 Phoenix
 
Transparent Object Persistence (within FLOW3)
Transparent Object Persistence (within FLOW3)Transparent Object Persistence (within FLOW3)
Transparent Object Persistence (within FLOW3)
 
JavaScript for PHP Developers
JavaScript for PHP DevelopersJavaScript for PHP Developers
JavaScript for PHP Developers
 
Transparent Object Persistence with FLOW3
Transparent Object Persistence with FLOW3Transparent Object Persistence with FLOW3
Transparent Object Persistence with FLOW3
 
TDD (with FLOW3)
TDD (with FLOW3)TDD (with FLOW3)
TDD (with FLOW3)
 
Implementing a JSR-283 Content Repository in PHP
Implementing a JSR-283 Content Repository in PHPImplementing a JSR-283 Content Repository in PHP
Implementing a JSR-283 Content Repository in PHP
 
Knowledge Management in der TYPO3 Community
Knowledge Management in der TYPO3 CommunityKnowledge Management in der TYPO3 Community
Knowledge Management in der TYPO3 Community
 
Unicode & PHP6
Unicode & PHP6Unicode & PHP6
Unicode & PHP6
 
Implementing a JSR-283 Content Repository in PHP
Implementing a JSR-283 Content Repository in PHPImplementing a JSR-283 Content Repository in PHP
Implementing a JSR-283 Content Repository in PHP
 
Introduction to Source Code Management
Introduction to Source Code ManagementIntroduction to Source Code Management
Introduction to Source Code Management
 

Último

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 

Último (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 

i18n and L10n in TYPO3 Flow

  • 1. i18n and L10n in TYPO3 Flow Karsten Dambekalns Inspiring people to share
  • 2. Karsten Dambekalns co-lead of TYPO3 Neos and Flow 35 years old lives in Lübeck, Germany 1 wife, 3 sons, 1 espresso machine likes canoeing and climbing Inspiring people to share
  • 3. Basics i18n is the process of making software localizable L10n means actually • formatting dates, numbers, … • translating text • adjusting other things (images, …) Inspiring people to share
  • 4. Locale Locale instances encapsulate a locale identifier Locales define the language and formats to use Locales form a hierarchy • en is a parent of en_US which is a parent of en_US_POSIX • Thus items for the en_US locale that do Inspiring people to share
  • 5. What you need A way to translate in templates A way to store translations of labels Formatters for dates, numbers, … An API for use in PHP Inspiring people to share
  • 6. f:translate the way of translating you will use most <f:translate id="my.label.1"/> {f:translate(id: 'my.label.1')} translation by label is possible, but discouraged • less reliable than id-based translation Inspiring people to share
  • 7. f:translate <f:translate id="my.label.1" source="Registration" package="Acme.Demo"/> <f:translate id="my.label.1" arguments="{0: 'hi'}" quantity="2"/> Inspiring people to share
  • 8. f:form.select has translation support built in <f:form.select options="{paymentOptions}" translate="{by: 'id'}" /> <f:form.select options="{paymentOptions}" translate="{by: 'id', prefix: 'payment.options.', package: 'Acme.Demo.Translations'}" /> Inspiring people to share
  • 9. Message catalogs XML Localisation Interchange File Format is the standard we use Looked up in well-known location Resources/ Private/ Translations/ <locale>/ <source>.xlf Inspiring people to share
  • 10. XLIFF basics An XLIFF file can hold translations for one locale It contains one or more <file> elements corresponding to a source Localizable data is stored in <trans-unit> elements which contain a <source> element to store the source text and a (non-mandatory) <target> Inspiring people to share
  • 11. <?xml version="1.0" encoding="UTF-8"?> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> <file original="" product-name="Acme.Demo" source- language="en" datatype="plaintext"> <body> Text <trans-unit id="my.label.1" xml:space="preserve"> Text <source>My Label 1</source> </trans-unit> </body> </file> </xliff> Inspiring people to share
  • 12. <?xml version="1.0" encoding="UTF-8"?> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> <file original="" product-name="Acme.Demo" source- language="en" datatype="plaintext"> <body> <trans-unit id="my.label.1" xml:space="preserve"> <source>My Label 1</source> <target>Mein Aufkleber 1</target> </trans-unit> </body> </file> </xliff> Inspiring people to share
  • 13. i18n configuration Default locale can be set in Settings.yaml Locale fallback rules are configurable TYPO3: Flow: i18n: defaultLocale: de fallbackRule: strict: FALSE order: [lv, en] Inspiring people to share
  • 14. i18n configuration Default locale can be set in Settings.yaml Locale fallback rules are configurable TYPO3: Flow: i18n: defaultLocale: de fallbackRule: strict: FALSE order: [lv, en] Inspiring people to share
  • 15. Placeholder use $this->view->assign('foo', 'QUUX'); $this->view->assign('bar', 'BAZ'); <f:translate id="my.label.3" arguments="{0: foo, 1: bar}"/> <trans-unit id="my.label.3" xml:space="preserve"> <source>I have {0} and {1}</source> <target>{1} habe ich und {0} habe ich auch</target> </trans-unit> Inspiring people to share
  • 16. String placeholders * will be available with Flow 2.0 $this->view->assign('foo', 'QUUX'); $this->view->assign('bar', 'BAZ'); <f:translate id="my.label.3" arguments="{'some': foo, 'thing': bar}"/> <trans-unit id="my.label.3" xml:space="preserve"> <source>I have {some} and {thing}</source> <target>{thing} habe ich und {some} habe ich auch</target> </trans-unit> Inspiring people to share
  • 17. Using formatters $this->view->assign('currentDateAndTime', new DateTime()); $this->view->assign('currentCost', 1.25); <f:translate id="my.label.4" arguments="{ 0: currentDateAndTime, 1: currentCost }"/> <source> At {0,datetime} it costs {1,number} monetary units </source> Inspiring people to share
  • 18. Plural forms The CLDR defines six plural forms • zero, one, two, few, many, other Different languages use more or less forms • singular and plurals for English • one, few and other for Polish • only other for Japanese Inspiring people to share
  • 19. Plural forms <f:translate id="my.label.6" quantity="{quarks->f:count()}"/> <group id="my.label.6" restype="x-gettext-plurals"> <trans-unit id="my.label.6[0]" xml:space="preserve"> <source>There is this quark</source> </trans-unit> <trans-unit id="my.label.6[1]" xml:space="preserve"> <source>There are these quarks</source> </trans-unit> </group> Inspiring people to share
  • 20. L10n of resources Resources can be localized as well The locale is part of the name • Image.png • Image.de.png • Image.lv.png Usable for all resources • Images, templates, … Inspiring people to share
  • 21. f:resource uses localized resources by default* <img src="{f:uri.resource(path: 'Images/Image.png')}"/> <img src="../../../../Resources/Public/Images/Image.png"/> * see Known Inspiring people to share
  • 22. i18n in PHP code TYPO3FlowI18nTranslator • translateById() • translateByOriginalLabel() TYPO3FlowI18nService • getConfiguration() • getLocalizedFilename() TYPO3FlowI18nFormatter* Inspiring people to share
  • 23. Setting current locale /** * @param string $locale * @return void */ public function selectAction($locale = NULL) { if ($locale !== NULL) { $this->i18nService->getConfiguration()->setCurrentLocale( new TYPO3FlowI18nLocale($locale) ); } WARN ING: $this->forward('index'); Stupid } ex ample Inspiring people to share
  • 24. Tips & Tricks Split catalogs at logical points Try to use.a.clever.id.system Avoid hardcoded labels from the start To change "original" labels simply translate to "original" language Inspiring people to share
  • 25. Known issues L10n support in f:resource VH pending in review Fallback per label is missing, currently only done per catalog Overriding parts of catalogs is missing Model translation still missing Inspiring people to share
  • 26. Thank You! These slides can be found at: http://speakerdeck.com/kdambekalns http://slideshare.net/kfish Give me feedback: karsten@typo3.org | karsten@dambekalns.de Download Flow: http://flow.typo3.org Follow me on twitter: @kdambekalns Support me using Inspiring people to share

Notas del editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n