SlideShare a Scribd company logo
Yii Framework
i18n – Internationalisation
Cass Surek
cass@surek.co.uk
Motivation
• Expand product reach
• Cater for multiple markets
• Improve usability
i18n - Internationalisation
• Software design process
• Multiple targets
• Multiple languages
• Multiple regions
• Avoid structural changes
• i + 18 letters + n – coined by DEC in the ’70s
L10n - Localisation
• Software adaptation process
• Based on internationalised software
• Use of locales
• Term translation
Yii support for i18n + L10n
• Locale and language
• Translation
• Date and Time Formatting
• Number Formatting
Locale
• CLocale class – e.g. Yii::app()->locale->dateFormat
• Locale codes: en_us, pt_br, en_gb, es (standardised
lowercase)
• Provides locale specific parameters
– Date format
– Currency symbols
– Month names
– Etc
Language
• Active locale setup on config file or at runtime
• Alters error messages to target language
Source
Language
(en_us)
Target Language 1
(pt_br)
Target Language 2
(es)
Target Language 3
(fr_fr)
Activation - setup
• Config file
– /protected/config/main.php
• Array(‘sourceLanguage’=>’en_gb’,
‘language’=>’pt_br’)
• Runtime
• Yii::app()->language= ‘pt_br’;
Translation
•Messages
•Views
Translation - Messages
Storage formats
– CPhpMessageSource (protected/messages)
– CGettextMessageSource (GNU Gettext files)
– CDbMessageSource (term tables)
• Yii::t(’category', 'Path alias "{alias}" is redefined.’,
array('{alias}'=>$alias))
Translation - Views
• CApplication::findLocalizedFile() – returns
language view file name if exists
• protected/views/ControllerID/zh_cn/edit.php
• Also used for images and data files
Date and Time Formatting
• CDateFormatter class
– Yii::app()->dateFormatter
• Uses current locale format
• Example
– Yii::app()->dateFormatter->formatDateTime(time())
Number Formatting
• CNumberFormatter class
– Yii::app()->numberFormatter
• Uses current locale format
• Example
– Yii::app()->numberFormatter->formatDecimal("8495873.00")
DEMO

More Related Content

Similar to Yii i18n Internationalisation

Internationalization (i18n) Primer
Internationalization (i18n) PrimerInternationalization (i18n) Primer
Internationalization (i18n) Primer
Lingoport (www.lingoport.com)
 
Introduction to Internationalization
Introduction to InternationalizationIntroduction to Internationalization
Introduction to InternationalizationEwa Barczykowska
 
Beyond English - Make Your Android App a Global Success
Beyond English - Make Your Android App a Global SuccessBeyond English - Make Your Android App a Global Success
Beyond English - Make Your Android App a Global SuccessMotorola Mobility - MOTODEV
 
Programming language design and implemenation
Programming language design and implemenationProgramming language design and implemenation
Programming language design and implemenationAshwini Awatare
 
Internationlization
InternationlizationInternationlization
InternationlizationTuan Ngo
 
ColdBox i18N
ColdBox i18N ColdBox i18N
ColdBox i18N
Oğuz Demirkapı
 
Devoxx: Developing for the Rest of the World
Devoxx: Developing for the Rest of the WorldDevoxx: Developing for the Rest of the World
Devoxx: Developing for the Rest of the World
Eric Frohnhoefer
 
I18n design approach for global enterprise platforms
I18n design approach for global enterprise platformsI18n design approach for global enterprise platforms
I18n design approach for global enterprise platforms
Reddappa Gowd Bandi
 
ICANN 51: IDN Program Update
ICANN 51: IDN Program UpdateICANN 51: IDN Program Update
ICANN 51: IDN Program Update
ICANN
 
Embedded firmware
Embedded firmwareEmbedded firmware
Embedded firmware
Joel P
 
computer-science_engineering_principles-of-programming-languages_introduction...
computer-science_engineering_principles-of-programming-languages_introduction...computer-science_engineering_principles-of-programming-languages_introduction...
computer-science_engineering_principles-of-programming-languages_introduction...
AshutoshSharma874829
 
LocServ - presentation of great localization and internationalization services
LocServ - presentation of great localization and internationalization servicesLocServ - presentation of great localization and internationalization services
LocServ - presentation of great localization and internationalization services
LocServ
 
Go Global Fearless(I18N & L10N)
Go Global Fearless(I18N & L10N)Go Global Fearless(I18N & L10N)
Go Global Fearless(I18N & L10N)
Venkat Rajesh
 
Engineering Your Product Information for Local Markets
Engineering Your Product Information for Local MarketsEngineering Your Product Information for Local Markets
Engineering Your Product Information for Local MarketsTom Knupp
 
Multi lingualenv
Multi lingualenvMulti lingualenv
Multi lingualenvgrantji
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compiler
Iffat Anjum
 
Low code development platform
Low code development platformLow code development platform
Low code development platform
Ehsan Hakimi
 
MVP Virtual Conference - Americas 2015 - Cross platform localization for mobi...
MVP Virtual Conference - Americas 2015 - Cross platform localization for mobi...MVP Virtual Conference - Americas 2015 - Cross platform localization for mobi...
MVP Virtual Conference - Americas 2015 - Cross platform localization for mobi...
Christopher Miller
 
Introduction to Internationalization (I18n)
Introduction to Internationalization (I18n)Introduction to Internationalization (I18n)
Introduction to Internationalization (I18n)
Lingoport (www.lingoport.com)
 

Similar to Yii i18n Internationalisation (20)

Internationalization (i18n) Primer
Internationalization (i18n) PrimerInternationalization (i18n) Primer
Internationalization (i18n) Primer
 
Introduction to Internationalization
Introduction to InternationalizationIntroduction to Internationalization
Introduction to Internationalization
 
Beyond English - Make Your Android App a Global Success
Beyond English - Make Your Android App a Global SuccessBeyond English - Make Your Android App a Global Success
Beyond English - Make Your Android App a Global Success
 
Programming language design and implemenation
Programming language design and implemenationProgramming language design and implemenation
Programming language design and implemenation
 
Internationlization
InternationlizationInternationlization
Internationlization
 
ColdBox i18N
ColdBox i18N ColdBox i18N
ColdBox i18N
 
Devoxx: Developing for the Rest of the World
Devoxx: Developing for the Rest of the WorldDevoxx: Developing for the Rest of the World
Devoxx: Developing for the Rest of the World
 
I18n design approach for global enterprise platforms
I18n design approach for global enterprise platformsI18n design approach for global enterprise platforms
I18n design approach for global enterprise platforms
 
ICANN 51: IDN Program Update
ICANN 51: IDN Program UpdateICANN 51: IDN Program Update
ICANN 51: IDN Program Update
 
Embedded firmware
Embedded firmwareEmbedded firmware
Embedded firmware
 
computer-science_engineering_principles-of-programming-languages_introduction...
computer-science_engineering_principles-of-programming-languages_introduction...computer-science_engineering_principles-of-programming-languages_introduction...
computer-science_engineering_principles-of-programming-languages_introduction...
 
LocServ - presentation of great localization and internationalization services
LocServ - presentation of great localization and internationalization servicesLocServ - presentation of great localization and internationalization services
LocServ - presentation of great localization and internationalization services
 
Go Global Fearless(I18N & L10N)
Go Global Fearless(I18N & L10N)Go Global Fearless(I18N & L10N)
Go Global Fearless(I18N & L10N)
 
Engineering Your Product Information for Local Markets
Engineering Your Product Information for Local MarketsEngineering Your Product Information for Local Markets
Engineering Your Product Information for Local Markets
 
Multi lingualenv
Multi lingualenvMulti lingualenv
Multi lingualenv
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compiler
 
Badusha_Profile
Badusha_ProfileBadusha_Profile
Badusha_Profile
 
Low code development platform
Low code development platformLow code development platform
Low code development platform
 
MVP Virtual Conference - Americas 2015 - Cross platform localization for mobi...
MVP Virtual Conference - Americas 2015 - Cross platform localization for mobi...MVP Virtual Conference - Americas 2015 - Cross platform localization for mobi...
MVP Virtual Conference - Americas 2015 - Cross platform localization for mobi...
 
Introduction to Internationalization (I18n)
Introduction to Internationalization (I18n)Introduction to Internationalization (I18n)
Introduction to Internationalization (I18n)
 

Recently uploaded

Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 

Recently uploaded (20)

Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 

Yii i18n Internationalisation

  • 1. Yii Framework i18n – Internationalisation Cass Surek cass@surek.co.uk
  • 2. Motivation • Expand product reach • Cater for multiple markets • Improve usability
  • 3. i18n - Internationalisation • Software design process • Multiple targets • Multiple languages • Multiple regions • Avoid structural changes • i + 18 letters + n – coined by DEC in the ’70s
  • 4. L10n - Localisation • Software adaptation process • Based on internationalised software • Use of locales • Term translation
  • 5. Yii support for i18n + L10n • Locale and language • Translation • Date and Time Formatting • Number Formatting
  • 6. Locale • CLocale class – e.g. Yii::app()->locale->dateFormat • Locale codes: en_us, pt_br, en_gb, es (standardised lowercase) • Provides locale specific parameters – Date format – Currency symbols – Month names – Etc
  • 7. Language • Active locale setup on config file or at runtime • Alters error messages to target language Source Language (en_us) Target Language 1 (pt_br) Target Language 2 (es) Target Language 3 (fr_fr)
  • 8. Activation - setup • Config file – /protected/config/main.php • Array(‘sourceLanguage’=>’en_gb’, ‘language’=>’pt_br’) • Runtime • Yii::app()->language= ‘pt_br’;
  • 10. Translation - Messages Storage formats – CPhpMessageSource (protected/messages) – CGettextMessageSource (GNU Gettext files) – CDbMessageSource (term tables) • Yii::t(’category', 'Path alias "{alias}" is redefined.’, array('{alias}'=>$alias))
  • 11. Translation - Views • CApplication::findLocalizedFile() – returns language view file name if exists • protected/views/ControllerID/zh_cn/edit.php • Also used for images and data files
  • 12. Date and Time Formatting • CDateFormatter class – Yii::app()->dateFormatter • Uses current locale format • Example – Yii::app()->dateFormatter->formatDateTime(time())
  • 13. Number Formatting • CNumberFormatter class – Yii::app()->numberFormatter • Uses current locale format • Example – Yii::app()->numberFormatter->formatDecimal("8495873.00")
  • 14. DEMO