Qu'est-ce qu'un domaine de texte de thème?
1 réponses
- votes
-
- 2012-12-11
Dans ce cas,
'themify'
est le domaine detexte définipour lethème,utilisépour rendre lethème traduisible . (Référence Codex:load_theme_textdomain()
).Préparer latraduction d'unthèmenécessite quelques étapes.
-
Définissez le domaine detexte duthème:
load_theme_textdomain( 'themify', TEMPLATEPATH.'/languages' );
-
Définissez des chaînestraduisibles dans lemodèle.
Cela sefaiten utilisant l'une des quelquesfonctions detraduction:
__()
(pour les chaînes renvoyées ),_e()
(pour les chaînes écho )et_x()
/_ex()
(pour les chaînes gettext context ). Il yen a d'autres,mais vous voyez l'idée ...Une chaîne detexte statique,telle que
<p>Hello world!</p>
,estenveloppée dans unefonction detraduction appropriée,telle que<p><?php _e( 'Hello World!', 'themify' ); ?></p>
,pour le rendre disponiblepourtraduction. -
Générer lesfichiers .mo/.po
référence sur commentmodifier lesfichiers de langue
In this case,
'themify'
is the defined textdomain for the Theme, used to make the Theme translatable. (Codex reference:load_theme_textdomain()
).Making a Theme translation-ready requires a few steps.
Define the Theme's textdomain:
load_theme_textdomain( 'themify', TEMPLATEPATH.'/languages' );
Define translatable strings in the template.
This is done using one of a few translation functions:
__()
(for returned strings),_e()
(for echoed strings), and_x()
/_ex()
(for gettext context strings). There are others, but you get the idea...A static text string, such as
<p>Hello world!</p>
, is wrapped in an appropriate translation function, such as<p><?php _e( 'Hello World!', 'themify' ); ?></p>
, to make it available for translation.Generate the .mo/.po files
reference on how to edit language files
-
@SokVanrithy,reportez-vous à [cette Q&R] (http://wordpress.stackexchange.com/q/57219/12615)pour savoir commentgérer lesfichiers `.mo/.po`.(Chip,je n'aipas ajouté le lien dans votre réponse car vous avezpeut-être une autre recommandation :)@SokVanrithy, refer to [this Q&A](http://wordpress.stackexchange.com/q/57219/12615) for how to handle `.mo/.po` files. (Chip, I haven't added the link into your Answer as you may have another recommendation:)
- 0
- 2012-12-11
- brasofilo
-
@brasofilo,n'hésitezpas à l'ajouter si vous le souhaitez.Jepense que c'est hors deportée de la questiontelle queposée,maistoujours desinformations utiles.@brasofilo feel free to add it if you'd like. I think it's out of scope for the question as-asked, but still useful information.
- 1
- 2012-12-11
- Chip Bennett
-
Pourquoi le changeriez-vous?Êtes-vousen train debifurquer lethème?Why would you change it? Are you forking the Theme?
- 0
- 2012-12-12
- Chip Bennett
-
Oui,je veuxm'en débarrasser.J'aitéléchargé unthème de Webdesigndepot,et il appelle `thème debase`.J'ai demandé à l'auteur quepourrais-je changer les codes originaux?Ils sont autorisés caril s'agit duthème vierge debasepour qui veut avoir la structure duthèmepersonnalisé.Deplus,c'est le cadeau de l'auteur là-bas à offrir au lecteur.Mon douteest comme ci-dessus!Yes, I want to get rid of them. I've downloaded a theme from Webdesigndepot, and it calls `base theme`. I asked the author that would I be able change the orginal codes? They're allowed because it is the base blank theme for whom who wanna have the structure for the custom theme. In addition, it's the present from the author there to give to the reader. My doubt is like above!
- 0
- 2012-12-12
- Sok Vanrithy
-
Bien sûr,vous *pouvez * vousen débarrasser;mais celane faitpasnonplus demal de les * laisser *.Vouspouvezmême changer le `textdomain`en une chaîne différente,pour référencer votrethèmeforké.Lesmeilleurespratiques de développementincluent lapossibilité detraduire lesthèmes,doncje déconseille * de les supprimer complètement.Cela dit,vous *pouvez * certainement,si vous le souhaitez.Sure, you *can* get rid of them; but it also doesn't hurt just to *leave* them. You can even change the `textdomain` to a different string, to reference your forked Theme. Development best practices include making Themes translatable, so I would advise *against* removing them entirely. That said, you certainly *can*, if you choose to.
- 1
- 2012-12-12
- Chip Bennett
-
Hey Chip,oùest unendroit communpour unthèmepour avoir l'appel load_theme_textdomain?J'aibesoin detrouver le domaine detexte d'unthème avec lequelje travaille.Hey Chip, where is a common place for a theme to have the load_theme_textdomain call? I need to find the text domain for a theme I am working with.
- 0
- 2013-06-27
- parker.sikand
-
"* ... oùest unendroit communpour unthèmepour avoir l'appel load_theme_textdomain? *" - dans `functions.php`,idéalement à l'intérieur d'un callback accroché à` after_setup_theme`."*...where is a common place for a theme to have the load_theme_textdomain call?*" - in `functions.php`, ideally inside a callback hooked into `after_setup_theme`.
- 0
- 2013-06-27
- Chip Bennett
J'aitrouvé quen'importe quelthème WordPress utilise cesfonctions,maisje ne comprendspas quelest sonbutet quelest-il,dans ce cas
'themify'
? Voici quelquesexemples dans Themifyfunctions.php
:1).
2).
Et dans unfichiertempate:
3).
<?php _e( 'Sorry, nothing found.', 'themify' ); ?>
Etbien d'autresencore!Mon douteest de savoir ce que signifie
'themify'
?Quelest leurbut?Puis-je lemodifier ou le supprimer?À quoi sert'themify'
?