I’d use printf
to put the markup into place after the translation. You can force the order with the right modifiers, but translators are probably smart enough to not really need that.
printf( __('The image %sMUST%s be less than %s500 KB%s in size.', CUSTOM_TEXT_DOMAIN), '<em>', '</em>', '<strong>', '</strong>' ) ;
I consider Otto’s post to be one of the definitive sources on how to translate strings in WordPress and one of his “rules” is don’t translate HTML.
Related Posts:
- How to get a translated string from a language other than the current one?
- How to get a localized version of WordPress from a repository?
- Working with l10n contexts (_x etc)
- How to escape the single quote character in i18n translation strings?
- How to escape single and plural i18n text strings?
- What are the most used WordPress localization?
- Difference between 2 internationalization (i18n) functions __() & _e()
- Localization works but still get “This plugin is not properly prepared for localization” msg in directory
- How to load theme textdomain from plugin?
- get_the_date() for translating date format
- Should i use _n for pronouns in translation?
- POEdit with Custom mu-plugins code
- How does WordPress choose which translation file to use?
- Proper way to create / manage gettext (.po, .pot) files?
- Should I include colon in my msgid in PO file?
- _e() function get text_string from function
- Translations not returning translated strings
- Force translated language on front
- Translating dynamic strings
- WordPress translation loading english file
- Easy export/import of data for Translation
- WordPress Theme .mo-file won’t load
- How to become a translator on wordpress.org?
- Translation from .mo file not working in theme
- WordPress localization – gettext and git
- Can I set WordPress to display languages based on system language without a plugin?
- /languages/ folder missing in default themes
- How to translate functions.php?
- WordPress Translations
- Post types translation
- Translate arguments of a user added custom code [closed]
- Internationalize plugin so strings can be translated in WPML [closed]
- localization of theme and plugins to English (originally in another language)
- Interface translation without plugins
- Plugin localization persistance (woocommerce)
- WordPress Localization error within return value
- Custom theme .mo translation file not working
- Plugin translation not displaying
- WordPress translation
- Tweak the loop for translation
- Translating form labels shortcode output
- Website Language/Locale Switching
- .po file is loaded but changes are not appearing
- gettext does not translate when called in ajax
- How do translated, escaped strings (esc_attr) in Themes work?
- what’s different between _x() and _()
- Obtain a list of available translations
- Best pratice to make taxonomy terms translatable without changing slugs?
- How to add extra language packs to WordPress
- load_plugin_textdomain in `plugins_loaded` or `init`?
- Translate Navigation Menu & Sidebar Widget Titles
- `wp_set_script_translations` with `wp.i18n` does not return translated strings in simple plugin
- Localization / textdomain is slow and chaotic
- How to handle single quote in a translatable string in WordPress
- WordPress: After Gutenberg plugin migration to block.json the localization/ translations with PolyGlot in JavaScript does not work anymore
- Where the WordPress Core Translation is “actually” taking place?
- What is the way to ship read-me strings like plugin-strings for internationalization?
- Using polylang, how can I see which post is the “original” and which are the “translated children”? [closed]
- Use WordPress default text domain for translating labels
- Override plugin text domain in child theme
- where to set the PO file for a plugin?
- Should I always prefer esc_attr_e & esc_html_e instead of _e?
- Replacing strings within posts with the translatable string
- Internationalization and functions that use it
- Translating a word with locotranslate, but wordpress does display another by default
- Two text domains in one plugin
- Action hook load_textdomain $domain variable
- How do I translate month names in post metadata?
- How to avoid override string by child theme mo files when the string is empty?
- Add a string to file .pot using Poedit
- Use the wp-admin translations on the front end
- How to translate get_intermediate_image_sizes?
- what’s different between _x() and _()
- Localization: I want the backend: english and frontend in defined language
- How to translate a string that contains a WordPress sitename
- Does the textdomain have to be the theme’s name?
- Translation for plugin
- Translation with wordpress what does the process involve?
- Can the qTranslateX-Plugin translate non-article text? [closed]
- Localization of WP theme
- How to add a translatable string to post date
- Programmatically choose language for translation
- Translate a theme with a PO file
- How to define theme translation file?
- WordPress Translation to french, at -> à not working
- String translation for esc_html__() when registering string [closed]
- how to unlocalize theme/plugin?
- __() function inside html tags
- How to do translations in WordPress?
- Qtranslate-X get raw post title value
- Menu names not getting translated
- Translation not working for Constant strings in Plugin
- qtranslate loading the wrong language
- issue in translating a wordpress them
- Understanding WordPress Default Theme – twentyfifteen.1.4 >> Languages Folder
- Adding a translation phrase to WordPress Theme
- Archive widget numbers translation?
- Poedit ASCII errors ( WordPress )
- Translating “comments”, “leave a comment”, “prev”, “next”, “share”
- Can’t load text domain in a mu-plugin