My first thought would be to wrap the string in a trim()
statement:
<?php _e( trim($text), $domain ) ?>
Would this do what you are wanting it to do or did I misunderstand your question?
EDIT: On looking further at the docs, while technically you may be able to get away with passing a variable, you should not pass variables into translation functions. See the examples section in the docs.
A better bet would be to translate multiple smaller fixed text strings and then join them later, or to adjust your code so that your whitespace is in your PHP and not your string/HTML.
Related Posts:
- What is the way to ship read-me strings like plugin-strings for internationalization?
- Making my plugin translation ready. Poedit not working
- 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?
- Translation issue with global variables
- How does translation (gettext) work for translating config file of plugin?
- Plugin not properly prepared for localization
- Use localized plugin name and description even when the plugin is disabled
- Translate a plugin using .po .mo files
- Override plugin localization
- translation does not work with text_domain
- How can I translate the name of my Plugin for other languages?
- Custom values are not translated
- Plugin translations problem
- Can’t we use strings defined as PHP constants if we want to translate them in a plugin?
- Why load_textdomain work but not load_plugin_textdomain?
- Language Translation is not working?
- Override plugin text domain in child theme
- load_theme_textdomain path
- Read text defined under __()
- Loco Translate: Custom Post and Custom Taxonomy Labels not translated in wp-admin menu
- Two text domains in one plugin
- Use translated taxonomy labels in plugin
- Force language in translate function
- Can I load the textdomain before a plugin is activated?
- How to prevent someone from entering strings without making it available for translation?
- Using wordpress translations strings in plugin
- Translations for my plugin don’t show up
- Setting Email locale before retrieving gettext translations
- How to translate user added content in a plugin
- Translation for a text that is not printed on the screen
- I dont know why my localization is not working
- Plugin: Translated plugin is “not translated”
- Translation not working for Constant strings in Plugin
- Change localization only for plugin
- Locale changed but plugin still showing default language
- WP internationalization not loaded
- Plugin translations are not loaded from translate.wordpress.org
- Admin Notice is only localized when displaying the “Plugins” Backend Page
- Update plugin from personal API
- Does a plugin’s “main” file need to be named the same as the folder containing it?
- Symlinked plugin directory doesn’t appear in Admin
- enqueue script only if it is not already enqueue
- Overwrite textdomain of plugins by default – Lost Translation
- How can I limit functionality in one version of a plugin?
- Plugin child folder?
- Can I use the same textdomain in two separate plugins?
- How use %like% in sql statement wordpress
- Can I use a form in a dashboard widget?
- Retrieving plugin options value saved through setting
- How to ‘clone’ a wp plugin to make small changes
- MITM risk of not sanitizing?
- Get IDs of Images from Gallery Block in InnerBlocks of a Custom Gutenberg Block
- Enqueue WordPress plugin scripts below all other JS
- White page by using filter template_include
- Is there any kind of theme on WordPress to sell my own movies?
- User switching only with specific role and return
- Fromcraft Plugin On click submit button [closed]
- Suggestions on Approach to New Plugin I’m Stuck On
- How WordPress is able to change locale without using setlocale
- How to redirect users to their profile after they successfully edit their profile
- WordPress error: Options page Setting_ not found in the allowed options list
- What is wordpress way to access a plugin’s classes/models to load custom post type data?
- flush_rewrite_rules() not working with update_option_{$option}
- Make plugin php file called directly aware of WordPress?
- How to add credit card validation check to wordpress [closed]
- Next Previous Post in wordpress with previous / next link with title?
- How to use existing hook in twentytwelve to all theme of wordpress?
- Apply html elements in php statement
- How to Get Category Name When Export Products
- Remove List Bullets
- How to set plugin auto-update Enabled by default?
- Custom plugin activation error
- How to capture hidden values with Gravity Forms
- How to translate wordpress blog to other languages?
- How to translate to spanish wordpress hardcoded content/files?
- what functions to use to resize images and create DB metadata for them after/during upload?
- Multiple image selection custom widget
- How to Create a Learning Management Plugin in WordPress to Manage Courses [LMS]
- Paid Membership Pro displaying a user name in PHP
- Make another copy of a plugin and install it
- Store admin page into variable
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- WP Plugin CSS not being applied to page
- Overwriting Plugin’s Ajax callback function from theme
- How can I get the Post ID and Post Type within a Must Use Plugin?
- Creating Nested custom fields
- Unable to sync woocommerce variations
- Can’t find variable is_single in my jQuery plugin
- WordPress Cron function is not working
- Plugin hook breaks new WP 4.0 media library grid view?
- How to get site homepage from plugin?
- Is an Office a custom post type [closed]
- How to add image for custom taxonomy
- WordPress Hooks : Where to place callbacks that repetitively yield the same effect?
- wordpress Ajax success doesn’t return the value
- add_meta_box showing blank screen in my page
- Use inline callable for hooks and filters
- Error in using ‘admin_enqueue_scripts’ action through a class
- How do i fix this error?