SlideShare ist ein Scribd-Unternehmen logo
1 von 21
Downloaden Sie, um offline zu lesen
• Introduction ……………………………………………………………………………. 3
• PHP comparison ……………………………………………………………………... 5
• What are locales ……………………………………………………………………… 5
• Message Catalog …………………………………………………………………….. 6
• PHP today Vs. yesterday ……………………………………………………………. 8
o Storing the strings in a relational database ………………….............……… 10
o Message Catalog ……………………………………………………………….. 12
o Storing the strings in JSON ........................................................................ 14
o Lingo Hub …………………………………………………………………...…… 16
• References …………………………………………………………………………..... 20
• While everyone who programs in PHP has to learn some English
eventually to get a handle on its function names and language
constructs, PHP can create applications in just about any human
language. Some applications need to be used by speakers of many
different languages. PHP's internationalization and localization
support makes it easier to make an application written for French
speakers useful for German speakers.
• Internationalization (often abbreviated I18N--there are 18 letters
between the first "i" and the last "n") is the process of taking an
application designed for just one locale and restructuring it so that it
can be used in many different locales. Localization (often abbreviated
L10N--there are 10 letters between the first "l" and the "n") is the
process of adding support for a new locale to an internationalized
application.
According to W3Tech statistics, PHP is used by 80.5% of all
websites and this share is continuously rising. We can safely say
that the web “speaks” PHP. But what about the content? Since PHP
has been around for such a long time (18 years), its history also
tells the story of the evolution of website internationalization. The
first article in our series about internationalization programming
focuses on PHP internationalization and its different dimensions
and options PHP makes possible.
A locale is a group of settings that describe text formatting and language
customs in a particular area of the world. A locale name generally has three
components. The first, an abbreviation that indicates a language, is mandatory.
For example, "en" stands for English and "pt" for Portuguese. An optional country
specifier comes next, after an underscore, to distinguish between different
versions of the same language spoken in different countries. For example,
"en_US" and "en_GB" specify U.S. and British English respectively, while
"pt_BR" and "pt_PT" identify Brazilian and Portugese Portuguese. Finally, after a
period, comes an optional character-set specifier. Taiwanese Chinese using the
Big5 character set is encoded as "zh_TW.Big5". Note that while most locale
names follow these conventions, some don't.
Back in the days of static websites, the developer would
copy the whole site structure as many times as the
number of locales that the site supported. The
translators would then go deep into the structure to
make the changes directly in the pages. This was tedious
and error prone. The translator would either need to
know the basics of HTML and what should/should not
be translated within the HTML file, or the developer
would have to pull all the text strings, send them to the
translator and then re-insert them back in the proper
place. It was not a very friendly or quick process for
either developer or translator.
Then came PHP and the dynamic web. In a dynamic website the
content is stored in a database or a file system, and is being inserted
into templates on each user request. The separation of content,
structure and design became a new mantra of web development.
When internationalizing the website, two steps need to be taken:
1. the developer provides a mechanism and method for content to
be accessible for the eventual translation of the program and its
interface (internationalization)
2. the translator adapts the content to specific language and culture
doing the actual localization.
There are various internationalization mechanisms at a developer’s
disposal and they differ greatly in their complexity, implementation
time, flexibility, efficiency and ease of use for the translator.
Another approach to PHP internationalization is to store the static strings
in a database. The most simple implementation is to add as many versions
of every string or text column as there are supported languages. The
specific translations can be retrieved with a single query, so there is no loss
of performance. When support for an extra locale needs to be added, the
code that pulls the translated string does not have to change much if the
naming of the columns is consistent, but every single table containing the
translatable content does (new columns need to be added).
To incorporate I18N support into your program, maintain a message catalog of
words and phrases and retrieve the appropriate string from the message catalog
before printing it. Here's a simple message catalog with foods in American and
British English and a function to retrieve words from the catalog:
This short program uses the message catalog to print out a list of foods:
To have the program output in American English instead of British English,
just set $LANG to en_US
Note that
When using this mechanism, a language file is loaded based on the configured
language. A static array $translations is used to ensure that the language file is
loaded once and every other subsequent call is handled through the $translations
array in the memory rather than reloading the language file anew. The language file is
constructed in JSON format and when the language file is loaded into the
$translations array the PHP json_decode function is used to convert from JSON into
PHP associative array format. When a call is made to the function, a language phrase
is passed to the function and the matching value is found in the $translations array
by using the language phrase as a key for the associative array. The .txt files need to
be utf-8 encoded (without BOM), otherwise the JSON PHP functions will not operate
correctly.
All of the listed mechanisms and methods for PHP internationalization
have some common shortcomings, and LingoHub deals with all of
them successfully. If resource files are used as the main i18n method,
and if resource files are uploaded as a part of the LingoHub project, it is
possible:
• for developers to automate synchronization
• for translators to focus on translating, without keeping their mind on
the technical methods used for internationalization
• for translators to see the context of the translations (such as meta
information, comments, screenshots)
• for developers to add rules and guidances on how particular
translations should be conducted (e.g. by defining LingoChecks,
setting specific regional variety of a language, setting formal/informal)
• for translators, reviewers and developers to communicate and
resolve any doubts on any of the translations using the LingoHub
platform, reducing Email traffic
• for project owners to keep track of the translation status of each
individual translation and the project in general
• for translators to easily and quickly find new or untranslated
phrases using filters, advanced search or notifications
• for multiple people (translators or reviewers) to work on the same
project simultaneously without any worry that they will undo each
others changes (e.g. via roles and permissions)
As a result, the PHP internationalization process is less of a hassle,
automated to a much greater degree, better quality control is available
and it is many, many times faster than it used to be. Ask us if you have
questions on how you can best internationalize your project, and check
out LingoHub to localize your product. Zero overhead, comfortable
integrations and scalability as you’d expect it from a cloud service.
• PHP Cookbook (By David Sklar, Adam Trachtenberg)
• Stack Over Flow
• GitHub
• LingoHub
• W3Techs
• A simple approach to Localization in PHP – Mind IT | Mind IT
Php packages

Weitere ähnliche Inhalte

Was ist angesagt?

Web Application Development using PHP Chapter 1
Web Application Development using PHP Chapter 1Web Application Development using PHP Chapter 1
Web Application Development using PHP Chapter 1Mohd Harris Ahmad Jaal
 
Python for MATLAB Programmers
Python for MATLAB ProgrammersPython for MATLAB Programmers
Python for MATLAB ProgrammersMichael Patterson
 
Python for Matlab Programmers
Python for Matlab ProgrammersPython for Matlab Programmers
Python for Matlab ProgrammersMichael Patterson
 
Php vs Python: The Comparison You Should Know
Php vs Python: The Comparison You Should KnowPhp vs Python: The Comparison You Should Know
Php vs Python: The Comparison You Should Knowcalltutors
 
MOLTO poster for ACL 2010, Uppsala Sweden
MOLTO poster for ACL 2010, Uppsala SwedenMOLTO poster for ACL 2010, Uppsala Sweden
MOLTO poster for ACL 2010, Uppsala SwedenOlga Caprotti
 
TRANSLATOR'S TOOLS, by Dr. Shadia Y. BAnjar
TRANSLATOR'S TOOLS, by Dr. Shadia Y. BAnjarTRANSLATOR'S TOOLS, by Dr. Shadia Y. BAnjar
TRANSLATOR'S TOOLS, by Dr. Shadia Y. BAnjarDr. Shadia Banjar
 
Web programming UNIT II by Bhavsingh Maloth
Web programming UNIT II by Bhavsingh MalothWeb programming UNIT II by Bhavsingh Maloth
Web programming UNIT II by Bhavsingh MalothBhavsingh Maloth
 
Combining the functional and oject oriented paradigms in the fobs-x scripting...
Combining the functional and oject oriented paradigms in the fobs-x scripting...Combining the functional and oject oriented paradigms in the fobs-x scripting...
Combining the functional and oject oriented paradigms in the fobs-x scripting...ijpla
 
Sphinx options to make training documentation easier to understand
Sphinx options to make training documentation easier to understandSphinx options to make training documentation easier to understand
Sphinx options to make training documentation easier to understandAlexander Loechel
 
File handling With Solve Programs
File handling With Solve ProgramsFile handling With Solve Programs
File handling With Solve ProgramsRohan Gajre
 

Was ist angesagt? (13)

Web Application Development using PHP Chapter 1
Web Application Development using PHP Chapter 1Web Application Development using PHP Chapter 1
Web Application Development using PHP Chapter 1
 
Python for MATLAB Programmers
Python for MATLAB ProgrammersPython for MATLAB Programmers
Python for MATLAB Programmers
 
Python for Matlab Programmers
Python for Matlab ProgrammersPython for Matlab Programmers
Python for Matlab Programmers
 
Protocol Buffers
Protocol BuffersProtocol Buffers
Protocol Buffers
 
Php vs Python: The Comparison You Should Know
Php vs Python: The Comparison You Should KnowPhp vs Python: The Comparison You Should Know
Php vs Python: The Comparison You Should Know
 
MOLTO poster for ACL 2010, Uppsala Sweden
MOLTO poster for ACL 2010, Uppsala SwedenMOLTO poster for ACL 2010, Uppsala Sweden
MOLTO poster for ACL 2010, Uppsala Sweden
 
TRANSLATOR'S TOOLS, by Dr. Shadia Y. BAnjar
TRANSLATOR'S TOOLS, by Dr. Shadia Y. BAnjarTRANSLATOR'S TOOLS, by Dr. Shadia Y. BAnjar
TRANSLATOR'S TOOLS, by Dr. Shadia Y. BAnjar
 
Web programming UNIT II by Bhavsingh Maloth
Web programming UNIT II by Bhavsingh MalothWeb programming UNIT II by Bhavsingh Maloth
Web programming UNIT II by Bhavsingh Maloth
 
Hack language
Hack languageHack language
Hack language
 
Combining the functional and oject oriented paradigms in the fobs-x scripting...
Combining the functional and oject oriented paradigms in the fobs-x scripting...Combining the functional and oject oriented paradigms in the fobs-x scripting...
Combining the functional and oject oriented paradigms in the fobs-x scripting...
 
Programming language
Programming languageProgramming language
Programming language
 
Sphinx options to make training documentation easier to understand
Sphinx options to make training documentation easier to understandSphinx options to make training documentation easier to understand
Sphinx options to make training documentation easier to understand
 
File handling With Solve Programs
File handling With Solve ProgramsFile handling With Solve Programs
File handling With Solve Programs
 

Ähnlich wie Php packages

PHP vs Python Which is Best for Web Development.pdf
PHP vs Python Which is Best for Web Development.pdfPHP vs Python Which is Best for Web Development.pdf
PHP vs Python Which is Best for Web Development.pdfchristiemarie4
 
Introduction to webprogramming using PHP and MySQL
Introduction to webprogramming using PHP and MySQLIntroduction to webprogramming using PHP and MySQL
Introduction to webprogramming using PHP and MySQLanand raj
 
Multi lingual corpus for machine aided translation
Multi lingual corpus for machine aided translationMulti lingual corpus for machine aided translation
Multi lingual corpus for machine aided translationAashna Phanda
 
Preparing an Open Source Documentation Repository for Translations
Preparing an Open Source Documentation Repository for TranslationsPreparing an Open Source Documentation Repository for Translations
Preparing an Open Source Documentation Repository for TranslationsHPCC Systems
 
languagetranslator-211028085026.pptx
languagetranslator-211028085026.pptxlanguagetranslator-211028085026.pptx
languagetranslator-211028085026.pptxMDASIFALI32
 
Language translator
Language translatorLanguage translator
Language translatorSumitSumit26
 
Python Programming Language
Python Programming LanguagePython Programming Language
Python Programming LanguageLaxman Puri
 
Learn PHP Lacture1
Learn PHP Lacture1Learn PHP Lacture1
Learn PHP Lacture1ADARSH BHATT
 
chapter 5 Server-Side Scripting (PHP).pdf
chapter 5 Server-Side Scripting (PHP).pdfchapter 5 Server-Side Scripting (PHP).pdf
chapter 5 Server-Side Scripting (PHP).pdfburasyacob012
 
Exploring PHP's Built-in Functions
Exploring PHP's Built-in FunctionsExploring PHP's Built-in Functions
Exploring PHP's Built-in FunctionsEmma Thompson
 
Web Development From the Ground Up, a Series for Novice ...
Web Development From the Ground Up, a Series for Novice ...Web Development From the Ground Up, a Series for Novice ...
Web Development From the Ground Up, a Series for Novice ...webhostingguy
 
Translation Markup Language and Universal Translation Memory
Translation Markup Language and Universal Translation MemoryTranslation Markup Language and Universal Translation Memory
Translation Markup Language and Universal Translation MemoryMichael Berkovich
 
Gianluca Giulinin - FAO
Gianluca Giulinin - FAO Gianluca Giulinin - FAO
Gianluca Giulinin - FAO RIILP
 
Programming assignment help by myassignmenthelp
Programming assignment help by myassignmenthelpProgramming assignment help by myassignmenthelp
Programming assignment help by myassignmenthelpwww.myassignmenthelp.net
 
Php tutorial(w3schools)
Php tutorial(w3schools)Php tutorial(w3schools)
Php tutorial(w3schools)Arjun Shanka
 

Ähnlich wie Php packages (20)

PHP vs Python Which is Best for Web Development.pdf
PHP vs Python Which is Best for Web Development.pdfPHP vs Python Which is Best for Web Development.pdf
PHP vs Python Which is Best for Web Development.pdf
 
Introduction to webprogramming using PHP and MySQL
Introduction to webprogramming using PHP and MySQLIntroduction to webprogramming using PHP and MySQL
Introduction to webprogramming using PHP and MySQL
 
Multi lingual corpus for machine aided translation
Multi lingual corpus for machine aided translationMulti lingual corpus for machine aided translation
Multi lingual corpus for machine aided translation
 
Preparing an Open Source Documentation Repository for Translations
Preparing an Open Source Documentation Repository for TranslationsPreparing an Open Source Documentation Repository for Translations
Preparing an Open Source Documentation Repository for Translations
 
languagetranslator-211028085026.pptx
languagetranslator-211028085026.pptxlanguagetranslator-211028085026.pptx
languagetranslator-211028085026.pptx
 
Language translator
Language translatorLanguage translator
Language translator
 
Python Programming Language
Python Programming LanguagePython Programming Language
Python Programming Language
 
methods and resources
methods and resourcesmethods and resources
methods and resources
 
Learn PHP Lacture1
Learn PHP Lacture1Learn PHP Lacture1
Learn PHP Lacture1
 
chapter 5 Server-Side Scripting (PHP).pdf
chapter 5 Server-Side Scripting (PHP).pdfchapter 5 Server-Side Scripting (PHP).pdf
chapter 5 Server-Side Scripting (PHP).pdf
 
Exploring PHP's Built-in Functions
Exploring PHP's Built-in FunctionsExploring PHP's Built-in Functions
Exploring PHP's Built-in Functions
 
PHP.docx
PHP.docxPHP.docx
PHP.docx
 
Moses
MosesMoses
Moses
 
Web Development From the Ground Up, a Series for Novice ...
Web Development From the Ground Up, a Series for Novice ...Web Development From the Ground Up, a Series for Novice ...
Web Development From the Ground Up, a Series for Novice ...
 
Php intro
Php introPhp intro
Php intro
 
Translation Markup Language and Universal Translation Memory
Translation Markup Language and Universal Translation MemoryTranslation Markup Language and Universal Translation Memory
Translation Markup Language and Universal Translation Memory
 
Gianluca Giulinin - FAO
Gianluca Giulinin - FAO Gianluca Giulinin - FAO
Gianluca Giulinin - FAO
 
Programming assignment help by myassignmenthelp
Programming assignment help by myassignmenthelpProgramming assignment help by myassignmenthelp
Programming assignment help by myassignmenthelp
 
Php tutorial(w3schools)
Php tutorial(w3schools)Php tutorial(w3schools)
Php tutorial(w3schools)
 
Php tutorialw3schools
Php tutorialw3schoolsPhp tutorialw3schools
Php tutorialw3schools
 

Kürzlich hochgeladen

%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile EnvironmentVictorSzoltysek
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2
 

Kürzlich hochgeladen (20)

%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 

Php packages

  • 1.
  • 2. • Introduction ……………………………………………………………………………. 3 • PHP comparison ……………………………………………………………………... 5 • What are locales ……………………………………………………………………… 5 • Message Catalog …………………………………………………………………….. 6 • PHP today Vs. yesterday ……………………………………………………………. 8 o Storing the strings in a relational database ………………….............……… 10 o Message Catalog ……………………………………………………………….. 12 o Storing the strings in JSON ........................................................................ 14 o Lingo Hub …………………………………………………………………...…… 16 • References …………………………………………………………………………..... 20
  • 3. • While everyone who programs in PHP has to learn some English eventually to get a handle on its function names and language constructs, PHP can create applications in just about any human language. Some applications need to be used by speakers of many different languages. PHP's internationalization and localization support makes it easier to make an application written for French speakers useful for German speakers.
  • 4. • Internationalization (often abbreviated I18N--there are 18 letters between the first "i" and the last "n") is the process of taking an application designed for just one locale and restructuring it so that it can be used in many different locales. Localization (often abbreviated L10N--there are 10 letters between the first "l" and the "n") is the process of adding support for a new locale to an internationalized application.
  • 5. According to W3Tech statistics, PHP is used by 80.5% of all websites and this share is continuously rising. We can safely say that the web “speaks” PHP. But what about the content? Since PHP has been around for such a long time (18 years), its history also tells the story of the evolution of website internationalization. The first article in our series about internationalization programming focuses on PHP internationalization and its different dimensions and options PHP makes possible.
  • 6.
  • 7. A locale is a group of settings that describe text formatting and language customs in a particular area of the world. A locale name generally has three components. The first, an abbreviation that indicates a language, is mandatory. For example, "en" stands for English and "pt" for Portuguese. An optional country specifier comes next, after an underscore, to distinguish between different versions of the same language spoken in different countries. For example, "en_US" and "en_GB" specify U.S. and British English respectively, while "pt_BR" and "pt_PT" identify Brazilian and Portugese Portuguese. Finally, after a period, comes an optional character-set specifier. Taiwanese Chinese using the Big5 character set is encoded as "zh_TW.Big5". Note that while most locale names follow these conventions, some don't.
  • 8. Back in the days of static websites, the developer would copy the whole site structure as many times as the number of locales that the site supported. The translators would then go deep into the structure to make the changes directly in the pages. This was tedious and error prone. The translator would either need to know the basics of HTML and what should/should not be translated within the HTML file, or the developer would have to pull all the text strings, send them to the translator and then re-insert them back in the proper place. It was not a very friendly or quick process for either developer or translator.
  • 9. Then came PHP and the dynamic web. In a dynamic website the content is stored in a database or a file system, and is being inserted into templates on each user request. The separation of content, structure and design became a new mantra of web development. When internationalizing the website, two steps need to be taken: 1. the developer provides a mechanism and method for content to be accessible for the eventual translation of the program and its interface (internationalization) 2. the translator adapts the content to specific language and culture doing the actual localization. There are various internationalization mechanisms at a developer’s disposal and they differ greatly in their complexity, implementation time, flexibility, efficiency and ease of use for the translator.
  • 10. Another approach to PHP internationalization is to store the static strings in a database. The most simple implementation is to add as many versions of every string or text column as there are supported languages. The specific translations can be retrieved with a single query, so there is no loss of performance. When support for an extra locale needs to be added, the code that pulls the translated string does not have to change much if the naming of the columns is consistent, but every single table containing the translatable content does (new columns need to be added).
  • 11.
  • 12. To incorporate I18N support into your program, maintain a message catalog of words and phrases and retrieve the appropriate string from the message catalog before printing it. Here's a simple message catalog with foods in American and British English and a function to retrieve words from the catalog:
  • 13. This short program uses the message catalog to print out a list of foods: To have the program output in American English instead of British English, just set $LANG to en_US Note that
  • 14. When using this mechanism, a language file is loaded based on the configured language. A static array $translations is used to ensure that the language file is loaded once and every other subsequent call is handled through the $translations array in the memory rather than reloading the language file anew. The language file is constructed in JSON format and when the language file is loaded into the $translations array the PHP json_decode function is used to convert from JSON into PHP associative array format. When a call is made to the function, a language phrase is passed to the function and the matching value is found in the $translations array by using the language phrase as a key for the associative array. The .txt files need to be utf-8 encoded (without BOM), otherwise the JSON PHP functions will not operate correctly.
  • 15.
  • 16. All of the listed mechanisms and methods for PHP internationalization have some common shortcomings, and LingoHub deals with all of them successfully. If resource files are used as the main i18n method, and if resource files are uploaded as a part of the LingoHub project, it is possible:
  • 17. • for developers to automate synchronization • for translators to focus on translating, without keeping their mind on the technical methods used for internationalization • for translators to see the context of the translations (such as meta information, comments, screenshots) • for developers to add rules and guidances on how particular translations should be conducted (e.g. by defining LingoChecks, setting specific regional variety of a language, setting formal/informal)
  • 18. • for translators, reviewers and developers to communicate and resolve any doubts on any of the translations using the LingoHub platform, reducing Email traffic • for project owners to keep track of the translation status of each individual translation and the project in general • for translators to easily and quickly find new or untranslated phrases using filters, advanced search or notifications • for multiple people (translators or reviewers) to work on the same project simultaneously without any worry that they will undo each others changes (e.g. via roles and permissions)
  • 19. As a result, the PHP internationalization process is less of a hassle, automated to a much greater degree, better quality control is available and it is many, many times faster than it used to be. Ask us if you have questions on how you can best internationalize your project, and check out LingoHub to localize your product. Zero overhead, comfortable integrations and scalability as you’d expect it from a cloud service.
  • 20. • PHP Cookbook (By David Sklar, Adam Trachtenberg) • Stack Over Flow • GitHub • LingoHub • W3Techs • A simple approach to Localization in PHP – Mind IT | Mind IT