Internationalization and Localization
Internationalization is the process of making your theme or plugin capable of being translated to other languages by you or other users, that means to use certain functions at the time of outputting to the front-end.
On the other hand, Localisation is the process of translating a theme or plugin into some desired language.
Text Domain
Text domain is a unique string which helps wordpress recognize the group of files/text belonging to a certain plugin.
Text-domain should match the plugins slug
Functions for internationalization
- __( ‘String’, ‘text-domain’ ) function in code, this function would return the String according to the localization, this function won’t echo the string.
- _e( ‘String’, ‘text-domain’ ) you can use this function is you want to echo the string as well
- Always escape the date also
- Use placeholders instead of variables
Some more functions :
__
_e
esc_html__
esc_attr__