You have to use a plural aware function like _n()
or _nx()
, because the words around the number might change in some languages depending on the amount items.
For visible numbers use number_format_i18n()
and %s
, not %d
.
You cannot reuse the labels, because plural forms change depending on context in some languages.
This is how I would write your example:
// bare number, needed for _n()
$num = count( $created );
// Singular or plural, we use %s, because we don't know what
// number_format_i18n() will return.
$text = _n(
'Created %s category',
'Created %s categories',
$num,
'unique_plugin_textdomain'
);
// thousands separator etc.
$display_number = number_format_i18n( $num );
// Finally, the result:
$message = sprintf( $text, $display_number );
Related Posts:
- Translate a plugin using .po .mo files
- What is the way to ship read-me strings like plugin-strings for internationalization?
- Override plugin text domain in child theme
- Making my plugin translation ready. Poedit not working
- Two text domains in one plugin
- What can be reason for no plugin-strings available under stable section on translate.wordpress.org?
- Is there a way to test that readme looks in other language before submitting translation?
- Setting Email locale before retrieving gettext translations
- Translation issue with global variables
- How to ignore extra whitespaces in translation functions like _e?
- Plugin not properly prepared for localization
- How to translate user added content in a plugin
- Use localized plugin name and description even when the plugin is disabled
- I dont know why my localization is not working
- Locale changed but plugin still showing default language
- Admin Notice is only localized when displaying the “Plugins” Backend Page
- Can I leave off plugin textdomain for terms used in core?
- [Plugin WPML] : How to create a translation of a post using the WPML API?
- __(): What if I have to pass in a variable?
- Overriding single plugin translation
- Using plural-only translation of register_post_status() in plugin
- Override plugin localization
- Adding a text domain to every __(), _e() and __n() gettext call without a plan to create own translations
- Force Plugin to English Translation
- Overwrite textdomain of plugins by default – Lost Translation
- Why can I not use a class constant as text domain?
- What is the purpose of adding a .po file?
- translation does not work with text_domain
- How can I translate the name of my Plugin for other languages?
- Is it necessary to translate WordPress key terms when localizing a plugin
- Plugin readme.txt and assets internationalization
- Custom values are not translated
- Translate wordpress plugin [closed]
- Suggestions for i18n plugin [closed]
- Why load_textdomain work but not load_plugin_textdomain?
- Language Translation is not working?
- How WordPress knows where to find locale files?
- Are contributed plugin translations automatically installed in WordPress?
- Translating plugin inside the theme [closed]
- Can I use the same textdomain in two separate plugins?
- Localiztion in javascript
- Possible to add a language file to a plugin without adding .po/.mo files to plugin directory?
- Internationalization: Not loading plugin translated text
- load_theme_textdomain path
- Read text defined under __()
- Why is the generated POT file from WordPress.org not adding my plugin description to the POT file?
- Loco Translate: Custom Post and Custom Taxonomy Labels not translated in wp-admin menu
- Internationalization autocomplete JS variable
- How to add links in .po (language) file in wordpress?
- Change the backend language of a single plugin
- Translating long texts with html formatting
- How to translate __(”) strings in admin [closed]
- Is it possible to use multiple post_name, post_title and post_content?
- How to merge two .PO language files?
- A new translation folder overrides my usual translation from “nowhere”
- Is there any way to use google input tool or any other language keyboard with WordPress [closed]
- Force language in translate function
- Can I load the textdomain before a plugin is activated?
- Load plugins’.mo and .po files from a directory
- Translation for the plugin using redux framework does not work
- How WordPress is able to change locale without using setlocale
- How I can internationalize variables within the function _e () __ (), etc?
- Plugin for single language localisation [closed]
- Cart66 localization hardcode strings [closed]
- Localize plugin name
- Using wordpress translations strings in plugin
- Using Variable in WordPress Translate Functions
- Translations for my plugin don’t show up
- How to translate WP Blog (search, category etc.)?
- Plugin translation not working on WordPress.org
- How does translation (gettext) work for translating config file of plugin?
- Update-safe translating of single text string in plugin
- Override translation of 1 word
- Replace woocommerce | (pipe) separator in product variation to , or another character?
- Localise settings section headline
- I’m looking for a visual composer / builder plugin that supports RTL
- How to install a translation for a WP plugin?
- Rename existing cpt and taxonomy with new textdomain
- TranslatePress | secondary language category/sub-category not working correctly “`/%category%/%postname%/“`
- Translations not appended even strings are edited
- How can I change a translation for a string in a plugin?
- How to add label/badge on bookable product based on their booking status
- How to translate wordpress blog to other languages?
- How to change WordPress core language using Loco Translate?
- Securing langugae folder
- Use Case: Multiple Shipping Methods per Order
- Suspect incomplete .pot file – what to do?
- Translation plugin with default language?
- plugin translation is not working
- Change localization only for plugin
- Plugin Translation project not found
- WP internationalization not loaded
- Adding a Filter to Sidbar Login Plugin to Change Login Button Lable
- Google Language Translator – Manage Translation
- Translate Woosidebars plugin strings
- Loading Canvas & WooCommerce translation file in child theme
- Gtranslate function with custom menu
- plugin translations not reflected in admin dashboard
- Plugin translations are not loaded from translate.wordpress.org
- plugin translation *.mo file not getting loaded for custom post