SlideShare una empresa de Scribd logo
1 de 78
Descargar para leer sin conexión
Atelier: traduire un thème

(ou une extension)

WordPress
Yoav Farhi
@yoavf

https://yoav.blog
Qui suis-je?
๏ Contributeur WordPress (cœur) et
GlotPress
๏ Développeur @ Automattic
๏ Specialist localization (L10N)
1. Traduction de thèmes et extensions
hébergés sur WordPress.org
2. La traduction WordPress - introduction
3. Autres thèmes et extensions
4. La traduction de WordPress (core).
Aujourd’hui
C’EST FACILE!
Thèmes et extensions

hébergés sur WordPress.org
Processus
prérequis: Thème / Extension compatible.
Traduction sur translate.wordpress.org
Pack de langue crée / mis-a-jour
Validations des traductions
WordPress télécharge les traductions.
https://fr.wordpress.org/themes/



https://fr.wordpress.org/plugins/
La Traduction
Outil d’uniformité
Outil d’uniformité
Delete
Outil d’uniformité
Delete
La Validation
PTE
GPTE
GTE
Les Roles
Project Translation Editor
GPTE
GTE
Les Roles
Project Translation Editor
Global Project Translation Editor
GTE
Les Roles
Project Translation Editor
Global Project Translation Editor
General Translation Editor
Les Roles
Creation du «Pack de langue »
Téléchargement des traductions
“
”
Great success !
Travaux pratiques
Travaux pratiques
→ https://yoav.fr/themes
Liens et références: https://yoav.fr/wcnice
LA BASE
La traduction dans WordPress
1. Nos chaînes (texts, strings) destinées à l’utilisateur sont
entourées par des appels aux fonctions de localisation
(l10n) WordPress
2. On crée notre dictionnaire de base (POT)
3. Le traducteur en dérive un fichier PO contenant les
traductions
4. Ce fichier est compilé en version binaire MO
Gettext
Fonction de base
__( 'Add new post' )
+ context
__( 'Add new' )
Page ? Article ?
+ context
__( 'Add new' )
Page ? Article ?
_x( 'Add new', 'Post' )
+ échappement (escaping)
esc_attr( __( 'Add new post' ) )
esc_attr__( 'Add new post' )
esc_html__( 'Add new post’ )
__( 'Add new post' )
+ échappement + context
esc_attr_x( 'Add new', 'post' )
esc_html_x( 'Add new', 'post' )
+ affichage (echo)
__( 'Add new post' )
=

_e( 'Add new post' )
echo
+ context + affichage


=
_ex( 'Add new', 'Post' )
_x( 'Add new', 'Post' )echo
+ échappement + affichage
esc_attr_e( 'Add new post' )
esc_html_e( 'Add new post’ )
pluriel
_n( 'Delete %d comment', 'Delete %d comments', $count )
pluriel + context
_nx( '%d deleted', '%d deleted', $count,'post' )
Identifiant unique permettant le
chargement d’un dictionnaire de
traductions séparé pour chaque thème
ou extension.
Le “Text Domain”
Le `textdomain`
__( 'my text' )


Le `textdomain`
__( 'my text','default' )


Le `textdomain`
__( 'my text','default' )


__( 'my text', 'my-plugin' )

Thèmes - 

le “theme header”
/*
Theme Name: Atelier-WC-Nice
Author: WC Nice
Author URI: https://2018.nice.wordcamp.org
Description: Le Theme de notre atelier
Text Domain: atelier-wc-nice
Extensions - 

le “plugin header”
/*
 * Plugin Name: My Plugin
 * Author: Plugin Author
 * Text Domain: my-plugin
 */
* Optionnel depuis WordPress 4.6
• Definition du “Text Domain” dans le “Plugin/Theme Header”
• WP cherche par default le fichier appelé text-
domain_locale_CODE.mo dans le repertoire

wp-content/languages/plugins|themes/
• Sinon le theme ou l’extension peuvent appeler la fonction
load_plugin_textdomain() ou load_theme_textdomain()
• Dans ce cas, les fichier de traductions doivent être nommés
locale_CODE.mo
Chargement des traductions
VIVE POEDIT!
Traduir autres thèmes et extensions
POEdit
http://poedit.net
1. Créez un fichier PO
2. Traduction!
3. (Generation du fichier MO)
4. (Placement du fichier MO)
Étapes a suivre
Creation du fichier PO
1. A base de fichier POT existant (ou
nouveau)
2. A base des sources et mots-clefs
(fonctions l10n)
Creation de PO a base de POT
Creation de PO a base de POT
Creation de PO a base de POT
Creation de PO a base de POT
Creation de PO a base de POT
Creation de PO a base de mots clefs
Creation de PO a base de mots clefs
Creation de PO a base de mots clefs
Creation de PO a base de mots clefs
Creation de PO a base de mots clefs
Creation de PO a base de mots clefs
Creation de PO a base de mots clefs
Creation de PO a base de mots clefs
Creation de PO a base de mots clefs
Creation de PO a base de mots clefs
Mais...
Plus facile d’utiliser le “Blank WordPress POT” 

https://github.com/fxbenard/Blank-WordPress-Pot
Ou encore
Ou encore
Travaux pratiques
Travaux pratiques
1. Installation de POEdit
2. Creation d’un fichier PO français
pour un theme
→ https://yoav.fr/wcnice-theme
Liens et références: https://yoav.fr/wcnice
LA COMMUNAUTÉ
WordPress en Français
La communauté
• https://fr.wordpress.org/team/
• #traductions on https://wordpressfr.slack.com
Merci !
Yoav Farhi
@yoavf

https://yoav.blog
Liens et références: https://yoav.fr/wcnice

Más contenido relacionado

Similar a [Atelier] Comment traduire un thème (ou une extension) WordPress

La puissance des pseudo-éléments
La puissance des pseudo-élémentsLa puissance des pseudo-éléments
La puissance des pseudo-élémentsGeoffrey Croftє
 
Symfony2 - Un Framework PHP 5 Performant
Symfony2 - Un Framework PHP 5 PerformantSymfony2 - Un Framework PHP 5 Performant
Symfony2 - Un Framework PHP 5 PerformantHugo Hamon
 
20111006 bonnes pratiques-gi_g_v1
20111006 bonnes pratiques-gi_g_v120111006 bonnes pratiques-gi_g_v1
20111006 bonnes pratiques-gi_g_v1Gilles Guirand
 
Comment créer des hooks dans vos développements WordPress - WP Tech 2015
Comment créer des hooks dans vos développements WordPress - WP Tech 2015Comment créer des hooks dans vos développements WordPress - WP Tech 2015
Comment créer des hooks dans vos développements WordPress - WP Tech 2015Boiteaweb
 
20100221 my phingtool - blog
20100221   my phingtool - blog20100221   my phingtool - blog
20100221 my phingtool - blogPHPPRO
 
Migration de données… Destination WordPress !
Migration de données… Destination WordPress !Migration de données… Destination WordPress !
Migration de données… Destination WordPress !Willy Bahuaud
 
Conversion de template HTML en thème WordPress
Conversion de template HTML en thème WordPressConversion de template HTML en thème WordPress
Conversion de template HTML en thème WordPressChi Nacim
 
AlterWay SolutionsLinux Outils Industrialisation PHP
AlterWay SolutionsLinux Outils Industrialisation PHPAlterWay SolutionsLinux Outils Industrialisation PHP
AlterWay SolutionsLinux Outils Industrialisation PHPjulien pauli
 
Les bases complètes d'un site WordPress optimisé
Les bases complètes d'un site WordPress optimiséLes bases complètes d'un site WordPress optimisé
Les bases complètes d'un site WordPress optimiséDaniel Roch - SeoMix
 
Chapitre 1_HTML_complet_version1.pdf
Chapitre 1_HTML_complet_version1.pdfChapitre 1_HTML_complet_version1.pdf
Chapitre 1_HTML_complet_version1.pdfYassineZARIOUH
 
Développement d’extensions WordPress
Développement d’extensions WordPressDéveloppement d’extensions WordPress
Développement d’extensions WordPressChi Nacim
 
Formation Play! framework
Formation Play! frameworkFormation Play! framework
Formation Play! frameworkBenoît Simard
 
Internationalisation du Front
Internationalisation du FrontInternationalisation du Front
Internationalisation du FrontYannick Croissant
 
Jug algeria x wiki-atelier
Jug algeria x wiki-atelierJug algeria x wiki-atelier
Jug algeria x wiki-atelierAlgeria JUG
 

Similar a [Atelier] Comment traduire un thème (ou une extension) WordPress (20)

La puissance des pseudo-éléments
La puissance des pseudo-élémentsLa puissance des pseudo-éléments
La puissance des pseudo-éléments
 
HTML5
HTML5HTML5
HTML5
 
Symfony2 - Un Framework PHP 5 Performant
Symfony2 - Un Framework PHP 5 PerformantSymfony2 - Un Framework PHP 5 Performant
Symfony2 - Un Framework PHP 5 Performant
 
Lp web tp3_idse
Lp web tp3_idseLp web tp3_idse
Lp web tp3_idse
 
20111006 bonnes pratiques-gi_g_v1
20111006 bonnes pratiques-gi_g_v120111006 bonnes pratiques-gi_g_v1
20111006 bonnes pratiques-gi_g_v1
 
Comment créer des hooks dans vos développements WordPress - WP Tech 2015
Comment créer des hooks dans vos développements WordPress - WP Tech 2015Comment créer des hooks dans vos développements WordPress - WP Tech 2015
Comment créer des hooks dans vos développements WordPress - WP Tech 2015
 
20100221 my phingtool - blog
20100221   my phingtool - blog20100221   my phingtool - blog
20100221 my phingtool - blog
 
Migration de données… Destination WordPress !
Migration de données… Destination WordPress !Migration de données… Destination WordPress !
Migration de données… Destination WordPress !
 
Conversion de template HTML en thème WordPress
Conversion de template HTML en thème WordPressConversion de template HTML en thème WordPress
Conversion de template HTML en thème WordPress
 
AlterWay SolutionsLinux Outils Industrialisation PHP
AlterWay SolutionsLinux Outils Industrialisation PHPAlterWay SolutionsLinux Outils Industrialisation PHP
AlterWay SolutionsLinux Outils Industrialisation PHP
 
Les bases complètes d'un site WordPress optimisé
Les bases complètes d'un site WordPress optimiséLes bases complètes d'un site WordPress optimisé
Les bases complètes d'un site WordPress optimisé
 
WordPress
WordPressWordPress
WordPress
 
Chapitre 1_HTML_complet_version1.pdf
Chapitre 1_HTML_complet_version1.pdfChapitre 1_HTML_complet_version1.pdf
Chapitre 1_HTML_complet_version1.pdf
 
Développement d’extensions WordPress
Développement d’extensions WordPressDéveloppement d’extensions WordPress
Développement d’extensions WordPress
 
Formation Play! framework
Formation Play! frameworkFormation Play! framework
Formation Play! framework
 
Internationalisation du Front
Internationalisation du FrontInternationalisation du Front
Internationalisation du Front
 
Playing With PHP 5.3
Playing With PHP 5.3Playing With PHP 5.3
Playing With PHP 5.3
 
Exemple demarrage wp_v01
Exemple demarrage wp_v01Exemple demarrage wp_v01
Exemple demarrage wp_v01
 
Compte rendu Blend Web Mix 2015
Compte rendu Blend Web Mix 2015Compte rendu Blend Web Mix 2015
Compte rendu Blend Web Mix 2015
 
Jug algeria x wiki-atelier
Jug algeria x wiki-atelierJug algeria x wiki-atelier
Jug algeria x wiki-atelier
 

Más de Yoav Farhi

Your First Gutenberg Block
Your First Gutenberg BlockYour First Gutenberg Block
Your First Gutenberg BlockYoav Farhi
 
Gender-fair WordPress: Fixing translation inequality at the core
Gender-fair WordPress: Fixing translation inequality at the coreGender-fair WordPress: Fixing translation inequality at the core
Gender-fair WordPress: Fixing translation inequality at the coreYoav Farhi
 
Right To Left Languages Support – The Right Way
Right To Left Languages Support – The Right WayRight To Left Languages Support – The Right Way
Right To Left Languages Support – The Right WayYoav Farhi
 
Localization: beyond translation
Localization: beyond translationLocalization: beyond translation
Localization: beyond translationYoav Farhi
 
WordPress in NOT English - WordCamp Hamburg 2014
WordPress in NOT English - WordCamp Hamburg 2014WordPress in NOT English - WordCamp Hamburg 2014
WordPress in NOT English - WordCamp Hamburg 2014Yoav Farhi
 
Contributing to WordPress (Hebrew)
Contributing to WordPress (Hebrew)Contributing to WordPress (Hebrew)
Contributing to WordPress (Hebrew)Yoav Farhi
 
WordPress: From Antispambot to Zeroize
WordPress: From Antispambot to ZeroizeWordPress: From Antispambot to Zeroize
WordPress: From Antispambot to ZeroizeYoav Farhi
 
Distributed: Reinventing the Workplace
Distributed: Reinventing the WorkplaceDistributed: Reinventing the Workplace
Distributed: Reinventing the WorkplaceYoav Farhi
 
וורדפרס.קום - אתרי וורדפרס בקלות
וורדפרס.קום - אתרי וורדפרס בקלותוורדפרס.קום - אתרי וורדפרס בקלות
וורדפרס.קום - אתרי וורדפרס בקלותYoav Farhi
 
WordCamp Jerusalem - Doing it Wrong
WordCamp Jerusalem - Doing it WrongWordCamp Jerusalem - Doing it Wrong
WordCamp Jerusalem - Doing it WrongYoav Farhi
 
התוסף הראשון שלי - וורדפרס
התוסף הראשון שלי - וורדפרסהתוסף הראשון שלי - וורדפרס
התוסף הראשון שלי - וורדפרסYoav Farhi
 
WordPress theme translation
WordPress theme translationWordPress theme translation
WordPress theme translationYoav Farhi
 
WordPress RTL
WordPress RTL WordPress RTL
WordPress RTL Yoav Farhi
 
WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1Yoav Farhi
 

Más de Yoav Farhi (14)

Your First Gutenberg Block
Your First Gutenberg BlockYour First Gutenberg Block
Your First Gutenberg Block
 
Gender-fair WordPress: Fixing translation inequality at the core
Gender-fair WordPress: Fixing translation inequality at the coreGender-fair WordPress: Fixing translation inequality at the core
Gender-fair WordPress: Fixing translation inequality at the core
 
Right To Left Languages Support – The Right Way
Right To Left Languages Support – The Right WayRight To Left Languages Support – The Right Way
Right To Left Languages Support – The Right Way
 
Localization: beyond translation
Localization: beyond translationLocalization: beyond translation
Localization: beyond translation
 
WordPress in NOT English - WordCamp Hamburg 2014
WordPress in NOT English - WordCamp Hamburg 2014WordPress in NOT English - WordCamp Hamburg 2014
WordPress in NOT English - WordCamp Hamburg 2014
 
Contributing to WordPress (Hebrew)
Contributing to WordPress (Hebrew)Contributing to WordPress (Hebrew)
Contributing to WordPress (Hebrew)
 
WordPress: From Antispambot to Zeroize
WordPress: From Antispambot to ZeroizeWordPress: From Antispambot to Zeroize
WordPress: From Antispambot to Zeroize
 
Distributed: Reinventing the Workplace
Distributed: Reinventing the WorkplaceDistributed: Reinventing the Workplace
Distributed: Reinventing the Workplace
 
וורדפרס.קום - אתרי וורדפרס בקלות
וורדפרס.קום - אתרי וורדפרס בקלותוורדפרס.קום - אתרי וורדפרס בקלות
וורדפרס.קום - אתרי וורדפרס בקלות
 
WordCamp Jerusalem - Doing it Wrong
WordCamp Jerusalem - Doing it WrongWordCamp Jerusalem - Doing it Wrong
WordCamp Jerusalem - Doing it Wrong
 
התוסף הראשון שלי - וורדפרס
התוסף הראשון שלי - וורדפרסהתוסף הראשון שלי - וורדפרס
התוסף הראשון שלי - וורדפרס
 
WordPress theme translation
WordPress theme translationWordPress theme translation
WordPress theme translation
 
WordPress RTL
WordPress RTL WordPress RTL
WordPress RTL
 
WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1
 

[Atelier] Comment traduire un thème (ou une extension) WordPress