To make your code translatable, you need to use a unique text domain to designate all text that belongs to your particular theme or plugin. This involves adding a text domain to your project as well as loading it into your project. Doing this enables translators to easily extract all the text that needs to be translated from your code.
- [Voiceover] You've heard me reference…text domains all through out this course.…And this is the part where we look at…what it is and why it's significant.…To make your code translatable you need to use a unique…text domain to designate all text that…belongs to your particular theme or plug in.…Doing this enables translators to use automated tools,…some of those we'll look at here shortly,…to easily extract all the text that needs to be translated.…If you intend to submit your plug in or theme…to the WordPress repository,…there's a couple of things to be aware of.…
First, steer clear from underscores or special characters.…Use dashes instead to separate words.…Secondly, the folder name of the plug in…or theme should match your text domain.…Following these naming conventions enables WordPress's…automated translation services to work.…Now, to show you how this works,…I've got a local install of WordPress already set up.…If you've never set up WordPress locally, check out the…WordPress essential training course in our library.…
- Why internationalization is important
- Using the gettext() function
- Adding context for translations
- Adding and loading text domains for WordPress themes and plugins
- Translating using GlotPress