SlideShare a Scribd company logo
1 of 30
A11Y? I18N? L10N? UTF8?
WTF?
Understanding the
connections between:
accessibility,
internationalization,
localization,
and character sets
Michael
Toppa
@mtoppa
WordCamp
Lancaster
March 1, 2014
About me…
Solving the
Unicode
Puzzle:
PHP
Architect,
May 2005
Accessibility ≠ Disability
WCAG Accessibility (A11Y)
Guidelines
1. Perceivable
<img src="smiley.gif" alt="Smiley face">
2. Operable
<input accesskey="S" type="submit" value="Submit">
3. Understandable and Predictable
<a href="new.html" target="_blank">opens new window</a>
4. Robust and Compatible
<label for="first_name">First Name</label>
WCAG Accessibility (A11Y)
Guidelines
1. Perceivable
2. Operable
3. Understandable and Predictable
❖ Guideline 3.1.1 Language of Page:
❖ The default human language of each Web page can be
programmatically determined.
4. Robust and Compatible
The lang attribute
❖ Declare the language of a WordPress theme in
header.php:
<html <?php language_attributes(); ?>>
For a US English site, this renders as:
<html lang="en-US">
❖ In HTML 5, declare the language of part of a document
<div lang="fr">
Uses of the lang attribute
❖ Improves search engine results
❖ Helps support server content negotiation
❖ Supports spelling and grammar checkers
❖ Supports speech synthesizers and automated
translators
❖ Allows user-agents to select language appropriate fonts
Language appropriate fonts
Unicode?
Klingon for
Unicode
Before there was Unicode…
Lower ASCII
Before there was Unicode…
Upper ASCII: ISO 8859-1 (aka Latin
1)
Before there was Unicode…
Upper ASCII: ISO 8859-
2
The Unicode slogan
“Unicode provides a unique number for every
character, no matter what the platform, no
matter what the program, no matter what the
language.”
So what is UTF-8?
WordPress supports UTF-8
Learning everyday Japanese with Mangajin
Localization (L10N) and
Internationalization (I18N)
Localization
“Localization refers to the adaptation of a
product, application or document content
to meet the language, cultural and other
requirements of a specific target market
(a locale).”
This often involves more than just translation
Internationalization
“Internationalization is the design and
development of a product, application or
document content that enables easy
localization for target audiences that vary
in culture, region, or language.”
WordPress provides internationalization
features so you can localize your themes
and plugins
Step 1: use WordPress’ I18N
functions
❖ Wrap all your text in WordPress’ I18N functions, using a
custom “text domain”. Mine is “shashin”
❖ $greeting = __( 'Howdy', 'shashin' );
❖ <li><?php _e( 'Howdy', 'shashin' ); ?></li>
❖ $string = _x( 'Buffalo', 'an animal', 'shashin' );
❖ $string = _x( 'Buffalo', 'a city in New York', 'shashin' );
❖ And others…
Step 2: generate a POT file
Step 3: load your text domain
❖ For plugins:
load_plugin_textdomain(
'shashin',
false,
dirname(plugin_basename(__FILE__)) . '/languages/'
);
Step 3: load your text domain
❖ For themes:
function custom_theme_setup() {
load_theme_textdomain(
'my_theme',
get_template_directory() . '/languages')
);
}
add_action('after_setup_theme', 'custom_theme_setup');
Step 4: include translation
files
Questions?
Further reading
❖ W3C
❖ How to meet WCAG 2.0: quick reference
❖ Why use the language attribute?
❖ Localization vs. Internationalization
❖ WordPress
❖ How To Localize WordPress Themes and Plugins
❖ I18n for WordPress Developers
❖ Internationalization: You’re probably doing it wrong
❖ Solving the Unicode Puzzle

More Related Content

Viewers also liked

medicine.Lymphomas.(dr.sabir)
medicine.Lymphomas.(dr.sabir)medicine.Lymphomas.(dr.sabir)
medicine.Lymphomas.(dr.sabir)
student
 
[POMP 2013] Primož Inkret - Kako zgraditi vrhunsko CM strategijo v 13 korakih
[POMP 2013] Primož Inkret - Kako zgraditi vrhunsko CM strategijo v 13 korakih[POMP 2013] Primož Inkret - Kako zgraditi vrhunsko CM strategijo v 13 korakih
[POMP 2013] Primož Inkret - Kako zgraditi vrhunsko CM strategijo v 13 korakih
PM, poslovni mediji
 
'New Rules of Communication' Patrick Collister
'New Rules of Communication' Patrick Collister'New Rules of Communication' Patrick Collister
'New Rules of Communication' Patrick Collister
Post Media
 
Respiratory and Circulatory PRJ.
Respiratory and Circulatory PRJ. Respiratory and Circulatory PRJ.
Respiratory and Circulatory PRJ.
dillycasado
 

Viewers also liked (19)

Enterprising Cities 2013
Enterprising Cities 2013Enterprising Cities 2013
Enterprising Cities 2013
 
2.1.1 Проектирование
2.1.1 Проектирование2.1.1 Проектирование
2.1.1 Проектирование
 
medicine.Lymphomas.(dr.sabir)
medicine.Lymphomas.(dr.sabir)medicine.Lymphomas.(dr.sabir)
medicine.Lymphomas.(dr.sabir)
 
Как да стартираме онлайн бизнес успешно
Как да стартираме онлайн бизнес успешноКак да стартираме онлайн бизнес успешно
Как да стартираме онлайн бизнес успешно
 
Learning Technology
Learning TechnologyLearning Technology
Learning Technology
 
Data IO: Next Generation Search with Lucene and Solr 4
Data IO: Next Generation Search with Lucene and Solr 4Data IO: Next Generation Search with Lucene and Solr 4
Data IO: Next Generation Search with Lucene and Solr 4
 
1.5.4 Квартирные решения от ДКС
1.5.4 Квартирные решения от ДКС1.5.4 Квартирные решения от ДКС
1.5.4 Квартирные решения от ДКС
 
The Future of Social Media: 50+ Expects Share Their 2014 Predictions
The Future of Social Media: 50+ Expects Share Their 2014 PredictionsThe Future of Social Media: 50+ Expects Share Their 2014 Predictions
The Future of Social Media: 50+ Expects Share Their 2014 Predictions
 
RunDuck
RunDuckRunDuck
RunDuck
 
1.3.16 Система для организации рабочих мест
1.3.16 Система для организации рабочих мест 1.3.16 Система для организации рабочих мест
1.3.16 Система для организации рабочих мест
 
[POMP 2013] Primož Inkret - Kako zgraditi vrhunsko CM strategijo v 13 korakih
[POMP 2013] Primož Inkret - Kako zgraditi vrhunsko CM strategijo v 13 korakih[POMP 2013] Primož Inkret - Kako zgraditi vrhunsko CM strategijo v 13 korakih
[POMP 2013] Primož Inkret - Kako zgraditi vrhunsko CM strategijo v 13 korakih
 
Contest Admin Dashboard Guide
Contest Admin Dashboard GuideContest Admin Dashboard Guide
Contest Admin Dashboard Guide
 
OAuth: demystified (hopefully)
OAuth: demystified (hopefully)OAuth: demystified (hopefully)
OAuth: demystified (hopefully)
 
#Entitlements13 Event
#Entitlements13 Event#Entitlements13 Event
#Entitlements13 Event
 
'New Rules of Communication' Patrick Collister
'New Rules of Communication' Patrick Collister'New Rules of Communication' Patrick Collister
'New Rules of Communication' Patrick Collister
 
Respiratory and Circulatory PRJ.
Respiratory and Circulatory PRJ. Respiratory and Circulatory PRJ.
Respiratory and Circulatory PRJ.
 
Complex disasters
Complex disastersComplex disasters
Complex disasters
 
Complex disasters2
Complex disasters2Complex disasters2
Complex disasters2
 
WordCamp Boston 2015: Agile Contracts for WordPress Consultants
WordCamp Boston 2015: Agile Contracts for WordPress ConsultantsWordCamp Boston 2015: Agile Contracts for WordPress Consultants
WordCamp Boston 2015: Agile Contracts for WordPress Consultants
 

Similar to WordCamp Lancaster 2014: A11Y? I18N? L10N? UTF8? WTF?

WordPress internationalization, localization, and multilingual
WordPress internationalization, localization, and multilingualWordPress internationalization, localization, and multilingual
WordPress internationalization, localization, and multilingual
mbigul
 
C3 웹기술로만드는모바일앱
C3 웹기술로만드는모바일앱C3 웹기술로만드는모바일앱
C3 웹기술로만드는모바일앱
NAVER D2
 

Similar to WordCamp Lancaster 2014: A11Y? I18N? L10N? UTF8? WTF? (20)

A11Y? I18N? L10N? UTF8? WTF? Understanding the connections between: accessib...
A11Y? I18N? L10N? UTF8? WTF? Understanding the connections between:  accessib...A11Y? I18N? L10N? UTF8? WTF? Understanding the connections between:  accessib...
A11Y? I18N? L10N? UTF8? WTF? Understanding the connections between: accessib...
 
AIM | HDC 2016 Globalization As a Service
AIM | HDC 2016 Globalization As a ServiceAIM | HDC 2016 Globalization As a Service
AIM | HDC 2016 Globalization As a Service
 
Localization for iOS
Localization for iOSLocalization for iOS
Localization for iOS
 
Php ch-1_server_side_scripting_basics
Php ch-1_server_side_scripting_basicsPhp ch-1_server_side_scripting_basics
Php ch-1_server_side_scripting_basics
 
server side scripting basics by Bantamlak Dejene
server side scripting basics by Bantamlak Dejeneserver side scripting basics by Bantamlak Dejene
server side scripting basics by Bantamlak Dejene
 
server side scripting basics
server side scripting basicsserver side scripting basics
server side scripting basics
 
Creating a multilingual site with WPML
Creating a multilingual site with WPMLCreating a multilingual site with WPML
Creating a multilingual site with WPML
 
Java EE 7 from an HTML5 Perspective, JavaLand 2015
Java EE 7 from an HTML5 Perspective, JavaLand 2015Java EE 7 from an HTML5 Perspective, JavaLand 2015
Java EE 7 from an HTML5 Perspective, JavaLand 2015
 
WordPress Internationalization and Localization - WordPress Translation Day 3...
WordPress Internationalization and Localization - WordPress Translation Day 3...WordPress Internationalization and Localization - WordPress Translation Day 3...
WordPress Internationalization and Localization - WordPress Translation Day 3...
 
Training report on web developing
Training report on web developingTraining report on web developing
Training report on web developing
 
WordPress internationalization, localization, and multilingual
WordPress internationalization, localization, and multilingualWordPress internationalization, localization, and multilingual
WordPress internationalization, localization, and multilingual
 
Internship review
Internship reviewInternship review
Internship review
 
PHP and Silverlight
PHP and SilverlightPHP and Silverlight
PHP and Silverlight
 
Rust: Systems Programming for Everyone
Rust: Systems Programming for EveryoneRust: Systems Programming for Everyone
Rust: Systems Programming for Everyone
 
HTML5: An Introduction To Next Generation Web Development
HTML5: An Introduction To Next Generation Web DevelopmentHTML5: An Introduction To Next Generation Web Development
HTML5: An Introduction To Next Generation Web Development
 
Internationalizing The New York Times
Internationalizing The New York TimesInternationalizing The New York Times
Internationalizing The New York Times
 
HTML5 Introduction
HTML5 IntroductionHTML5 Introduction
HTML5 Introduction
 
C3 웹기술로만드는모바일앱
C3 웹기술로만드는모바일앱C3 웹기술로만드는모바일앱
C3 웹기술로만드는모바일앱
 
Multi Lingual Websites In Umbraco
Multi Lingual Websites In UmbracoMulti Lingual Websites In Umbraco
Multi Lingual Websites In Umbraco
 
HTML5: An Introduction To Next Generation Web Development
HTML5: An Introduction To Next Generation Web DevelopmentHTML5: An Introduction To Next Generation Web Development
HTML5: An Introduction To Next Generation Web Development
 

More from mtoppa

WordCamp Nashville 2015: Agile Contracts for WordPress Consultants
WordCamp Nashville 2015: Agile Contracts for WordPress ConsultantsWordCamp Nashville 2015: Agile Contracts for WordPress Consultants
WordCamp Nashville 2015: Agile Contracts for WordPress Consultants
mtoppa
 
Dependency Injection for Wordpress
Dependency Injection for WordpressDependency Injection for Wordpress
Dependency Injection for Wordpress
mtoppa
 
Clean code for WordPress
Clean code for WordPressClean code for WordPress
Clean code for WordPress
mtoppa
 
Dependency Inversion and Dependency Injection in PHP
Dependency Inversion and Dependency Injection in PHPDependency Inversion and Dependency Injection in PHP
Dependency Inversion and Dependency Injection in PHP
mtoppa
 

More from mtoppa (20)

RubyConf 2022 - From beginner to expert, and back again
RubyConf 2022 - From beginner to expert, and back againRubyConf 2022 - From beginner to expert, and back again
RubyConf 2022 - From beginner to expert, and back again
 
RailsConf 2022 - Upgrading Rails: The Dual Boot Way
RailsConf 2022 - Upgrading Rails: The Dual Boot WayRailsConf 2022 - Upgrading Rails: The Dual Boot Way
RailsConf 2022 - Upgrading Rails: The Dual Boot Way
 
Applying Omotenashi (Japanese customer service) to your work
Applying Omotenashi (Japanese customer service) to your workApplying Omotenashi (Japanese customer service) to your work
Applying Omotenashi (Japanese customer service) to your work
 
Talking to strangers causes train wrecks
Talking to strangers causes train wrecksTalking to strangers causes train wrecks
Talking to strangers causes train wrecks
 
The promise and peril of Agile and Lean practices
The promise and peril of Agile and Lean practicesThe promise and peril of Agile and Lean practices
The promise and peril of Agile and Lean practices
 
Why do planes crash? Lessons for junior and senior developers
Why do planes crash? Lessons for junior and senior developersWhy do planes crash? Lessons for junior and senior developers
Why do planes crash? Lessons for junior and senior developers
 
Boston Ruby Meetup: The promise and peril of Agile and Lean practices
Boston Ruby Meetup: The promise and peril of Agile and Lean practicesBoston Ruby Meetup: The promise and peril of Agile and Lean practices
Boston Ruby Meetup: The promise and peril of Agile and Lean practices
 
A real-life overview of Agile and Scrum
A real-life overview of Agile and ScrumA real-life overview of Agile and Scrum
A real-life overview of Agile and Scrum
 
WordCamp Nashville 2016: The promise and peril of Agile and Lean practices
WordCamp Nashville 2016: The promise and peril of Agile and Lean practicesWordCamp Nashville 2016: The promise and peril of Agile and Lean practices
WordCamp Nashville 2016: The promise and peril of Agile and Lean practices
 
WordCamp US: Clean Code
WordCamp US: Clean CodeWordCamp US: Clean Code
WordCamp US: Clean Code
 
Dependency Injection for PHP
Dependency Injection for PHPDependency Injection for PHP
Dependency Injection for PHP
 
WordCamp Nashville 2015: Agile Contracts for WordPress Consultants
WordCamp Nashville 2015: Agile Contracts for WordPress ConsultantsWordCamp Nashville 2015: Agile Contracts for WordPress Consultants
WordCamp Nashville 2015: Agile Contracts for WordPress Consultants
 
Rails testing: factories or fixtures?
Rails testing: factories or fixtures?Rails testing: factories or fixtures?
Rails testing: factories or fixtures?
 
WordCamp Nashville: Clean Code for WordPress
WordCamp Nashville: Clean Code for WordPressWordCamp Nashville: Clean Code for WordPress
WordCamp Nashville: Clean Code for WordPress
 
A real-life overview of Agile workflow practices
A real-life overview of Agile workflow practicesA real-life overview of Agile workflow practices
A real-life overview of Agile workflow practices
 
Why Agile? Why Now?
Why Agile? Why Now?Why Agile? Why Now?
Why Agile? Why Now?
 
Object Oriented Programming for WordPress Plugin Development
Object Oriented Programming for WordPress Plugin DevelopmentObject Oriented Programming for WordPress Plugin Development
Object Oriented Programming for WordPress Plugin Development
 
Dependency Injection for Wordpress
Dependency Injection for WordpressDependency Injection for Wordpress
Dependency Injection for Wordpress
 
Clean code for WordPress
Clean code for WordPressClean code for WordPress
Clean code for WordPress
 
Dependency Inversion and Dependency Injection in PHP
Dependency Inversion and Dependency Injection in PHPDependency Inversion and Dependency Injection in PHP
Dependency Inversion and Dependency Injection in PHP
 

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
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
Earley Information Science
 

Recently uploaded (20)

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
[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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
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...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

WordCamp Lancaster 2014: A11Y? I18N? L10N? UTF8? WTF?

  • 1. A11Y? I18N? L10N? UTF8? WTF? Understanding the connections between: accessibility, internationalization, localization, and character sets Michael Toppa @mtoppa WordCamp Lancaster March 1, 2014
  • 2.
  • 6. WCAG Accessibility (A11Y) Guidelines 1. Perceivable <img src="smiley.gif" alt="Smiley face"> 2. Operable <input accesskey="S" type="submit" value="Submit"> 3. Understandable and Predictable <a href="new.html" target="_blank">opens new window</a> 4. Robust and Compatible <label for="first_name">First Name</label>
  • 7. WCAG Accessibility (A11Y) Guidelines 1. Perceivable 2. Operable 3. Understandable and Predictable ❖ Guideline 3.1.1 Language of Page: ❖ The default human language of each Web page can be programmatically determined. 4. Robust and Compatible
  • 8. The lang attribute ❖ Declare the language of a WordPress theme in header.php: <html <?php language_attributes(); ?>> For a US English site, this renders as: <html lang="en-US"> ❖ In HTML 5, declare the language of part of a document <div lang="fr">
  • 9. Uses of the lang attribute ❖ Improves search engine results ❖ Helps support server content negotiation ❖ Supports spelling and grammar checkers ❖ Supports speech synthesizers and automated translators ❖ Allows user-agents to select language appropriate fonts
  • 13. Before there was Unicode… Lower ASCII
  • 14. Before there was Unicode… Upper ASCII: ISO 8859-1 (aka Latin 1)
  • 15. Before there was Unicode… Upper ASCII: ISO 8859- 2
  • 16. The Unicode slogan “Unicode provides a unique number for every character, no matter what the platform, no matter what the program, no matter what the language.”
  • 17. So what is UTF-8?
  • 19. Learning everyday Japanese with Mangajin
  • 21. Localization “Localization refers to the adaptation of a product, application or document content to meet the language, cultural and other requirements of a specific target market (a locale).” This often involves more than just translation
  • 22. Internationalization “Internationalization is the design and development of a product, application or document content that enables easy localization for target audiences that vary in culture, region, or language.”
  • 23. WordPress provides internationalization features so you can localize your themes and plugins
  • 24. Step 1: use WordPress’ I18N functions ❖ Wrap all your text in WordPress’ I18N functions, using a custom “text domain”. Mine is “shashin” ❖ $greeting = __( 'Howdy', 'shashin' ); ❖ <li><?php _e( 'Howdy', 'shashin' ); ?></li> ❖ $string = _x( 'Buffalo', 'an animal', 'shashin' ); ❖ $string = _x( 'Buffalo', 'a city in New York', 'shashin' ); ❖ And others…
  • 25. Step 2: generate a POT file
  • 26. Step 3: load your text domain ❖ For plugins: load_plugin_textdomain( 'shashin', false, dirname(plugin_basename(__FILE__)) . '/languages/' );
  • 27. Step 3: load your text domain ❖ For themes: function custom_theme_setup() { load_theme_textdomain( 'my_theme', get_template_directory() . '/languages') ); } add_action('after_setup_theme', 'custom_theme_setup');
  • 28. Step 4: include translation files
  • 30. Further reading ❖ W3C ❖ How to meet WCAG 2.0: quick reference ❖ Why use the language attribute? ❖ Localization vs. Internationalization ❖ WordPress ❖ How To Localize WordPress Themes and Plugins ❖ I18n for WordPress Developers ❖ Internationalization: You’re probably doing it wrong ❖ Solving the Unicode Puzzle

Editor's Notes

  1. In this talk I’m going to give you a sampling of several related topics, and daisy-chain them together. This talk is by no means comprehensive. My goal is to give you a general sense of the connections between accessibility, internationalization, localization, and character sets, to start you down the road to understanding how to make your web content as accessible as possible to people who speak different languages, and have various levels of reading capabilities.
  2. * I’ve been developing for the web since the days of HTML 1.0 and the Mosaic web browser. * This is my 6th WordCamp presentation, and I have 7 plugins at wordpress.org, dating back to 2006. * I was previously the Director of Development for WebDevStudios, and I managed the 17 person web application team at the U Penn School of Medicine. * I mostly work in Ruby on Rails now, and I also have experience with Java, Python, Perl, and of course, PHP.
  3. In 2005 I wrote an article on configuring Apache, Oracle, and PHP for Unicode, published in PHP Architect. At that time Unicode was just emerging as the new standard for character encoding, and configuring end-to-end support for using it in web applications was a significant undertaking. These days, Unicode support comes out of the box for the most part.
  4. Accessibility applies to: * older people * people with low literacy or not fluent in the language * people with low bandwidth connections or using older technologies * new and infrequent users *… and persons with disabilities
  5. The World Wide Web Consortium (W3c) put together version 2 of their Web Content Accessibility Guidelines in 2008, and it has 4 key principles: Perceivable - e.g. provide text alternatives for non-textual content Operable - e.g make all functionality available from the keyboard, provide good site navigation Understandable - e.g. help users avoid and prevent mistakes, such as clearly indicating errors in a form submission Robust - e.g. use valid HTML and maximize compatibility with user agents such as screen readers
  6. There are 17 guidelines to follow for making a web page understandable. The first one is that it should be possible to programmatically determine the language of a web page.
  7. WordPress itself has been translated to over 70 languages, but if you are developing a theme or plugin, you still need to make sure you are using the lang attribute appropriately. The language_attributes function will set a lang attribute based on the language specified in your wp-config.php file
  8. Content negotiation lets the browser tell the server what media types and languages it prefers, and the server will do its best to comply. There is a plugin to support this in WordPress.
  9. These 4 ideographic characters all have the same Unicode value and meanings in Chinese, Japanese, and Korean, but are rendered differently, depending on whether the lang attribute of the page is set to Simplified Chinese, Traditional Chinese, Japanese, or Korean.
  10. Unicode is a single character set designed to include characters from just about every writing system on the planet. This is a small section of the Unicode character map, showing characters used in languages spoken in Myanmar.
  11. It supports languages from off the planet as well. Although Klingon was not granted official incorporation into Unicode, the proposed code points for it still remain conspicuously available (which means if you download the Klingon font, and go to a blog written in Klingon, it will work).
  12. Unicode has been prevalent on the web for about 10 years now. In the 1960s, unaccented English characters, as well as various control characters for carriage returns, page feeds, etc., were each assigned a number from 0 to 127; there was general agreement on these number assignments, and so ASCII was born (American Standard Code for Information Interchange).
  13. The ASCII characters could fit in 7 bits, and computers used 8-bit bytes, which left an extra bit of space. This led to the proliferation of many different character sets, with each one using this extra space in a different way. Here’s Latin 1, which contains special symbols and accented characters for Western languages.
  14. Here’s the version of Upper ASCII that supports Slavic languages. There are 15 variations on this ISO standard. This means that text generated on, say, a computer in Russia would turn into gibberish if you tried to read it on a computer in the US. This happened because the number codes representing the Cyrillic characters were assigned to totally different characters on the US computer. This became a bit of a problem when everyone started using the internet.
  15. Unicode represents an effort to clean up this mess. Unicode can do this because it allows characters to occupy more than one byte, so it has enough room to store characters from languages around the world—even Asian languages that have thousands of characters. It’s a character set able to support over 1 million characters.
  16. Unicode is a character set, and there are 3 different ways to encode it. UTF-8 is the unicode encoding standard for the web because, like ASCII, it’s an 8-bit encoding, and it’s compatible with the Latin1 ASCII character set. This makes it backwards compatible with most previously created Western language documents.
  17. UTF-8 is the standard character encoding in WordPress, since version 2.2. Here’s an example from my blog, showing a multi-lingual post in the WordPress HTML editor.
  18. A multi-lingual page like that is fairly uncommon. More commonly, content is created in one language, but we want a standardized way to enable the creation of translations into other languages. This is where localization and internationalization come in.
  19. In addition to translation, this can also involve dealing with variations in numeric, date, currency, and time formats, varying legal requirements, and awareness of things that may be misunderstood or be offensive in other cultures.
  20. The POT file serves as a template for translating your theme or plugin into other languages. It extracts all the text you wrapped in the WordPress’ I18N functions and puts them in a single file. If you have a plugin in the wordpress.org repository, it can generate a POT file for you. There are other tools available for this as well. See the references at the end of this talk for other ways to generate a POT file for themes and plugins
  21. Put your POT file in a “languages” subdirectory. Providing this file with your plugin allows users willing to create a translation to do so, using an application called POEdit.
  22. This shows all the different language translations available for the popular plugin, Contact Form 7. With POEdit, a translator can take your POT file and create a translation to another language. This translation creates a textual .po file, and then a binary, compiled version of it, in a .mo file. If you include a .mo file translation that matches the language configuration of a WordPress site, your plugin will automatically be shown in that language. Maintaining translations can be difficult, as you will usually need to get an updated translation for each new release of your plugin or theme. Even just changes in line numbers can throw off the translation.
  23. For web sites to be accessible, they need to be perceivable, operable, robust, and understandable. I’ve focused on the language support aspects of understandability, and hopefully this quick introduction to character sets, internationalization, and localization has given you a good starting point for making your WordPress site, plugins, or themes accessible to users who speak different languages.