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
- WordPress Plugin translation not working EN To FR
- How to fix caching issue in PHP data from database
- woocommerce: Customize email with item total count
- How use wp_insert_post and add og:custom tags?
- Is there any way to sync Facebook Comments and with comments on WordPress website?
- Show Custom Post on Frontend
- How to dynamically add template in Innerblock?
- Access remote SFTP server via WordPress login?
- Fatal error “Call to undefined function is_plugin_active” each time the plugin is activated
- The Build menu theme is frozen with the wordpress theme
- Shortcode do not return the right data in post
- Add style to body based on url
- function post to trash problem
- Problem with checked box on wp car manager plugin
- How to call function in WordPress on button click?
- how to auto random increment for post view
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- Access “wp site health info” data from plugin
- Ultimate Members Default Post Layout problem
- Fatal error: require_once(): Failed opening required
- WordPress Frontend Page using Plugin
- best way to upload a large file to wordpress using wp all import
- Why do actions with class and public method don’t fire __construct()
- How to properly enqueue jQuery knob on WordPress without conflict?
- Potential issue that plugin could have when it will be installed on several sites
- show wc_add notices on particular page in woo commerce custom plugin development
- How to use functions found inside pluggable.php with my plugin files
- How to overwrite a plugin?
- Getting the same post on my related post
- The function called on the wp head hook becomes null
- Hide content for specific users with id
- adding dynamic/multiple slug values in ‘option_none_value’
- Is it okay to make a plugin to the WordPress repo, but limit it’s actions to maximum N events?
- How can I translate something in my class constructor of my plugin in WordPress?
- custom post type get_posts() function not work
- I want to schedule email (date, time is in database->table) wp_schedule_event() not working
- Error on plugin activation and creating new page
- Child theme modifications not showing up
- Create multiple posts when a custom post is created
- Define global variable in theme file and call that variable in plugin file
- Highlight admin menu items that are parent of existing core items
- How to create a page with the selected template after activating the plugin
- Why is my shortcode not working?
- WordPress rewrite rule depend on meta values not ids
- Update wordpress user roles not working as excepted
- Create new page in wordpress plugin which doesn’t exist
- Use WordPress Plugin without WP head
- Adding shortcodes to multiple pages with function
- Rename a folder via HTML POST request
- The plugin generated 227 characters of unexpected output during activation. If you notice “headers already sent” messages
- SASS not showing in customized preloader plugin
- How to capture hidden values with Gravity Forms
- How to securely controlling data without keeping it in postmeta?
- How to translate wordpress blog to other languages?
- The styles in the recent posts widgets plugin not working
- How to change “Read More” text?
- How to call a function from class in wp table list button form
- How to translate to spanish wordpress hardcoded content/files?
- Cron task gets removed from the schedule
- what functions to use to resize images and create DB metadata for them after/during upload?
- How to get the checkout form data from checkout page when place-order button is clicked