Questions tagged [xgettext]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
170 views

What does the underscore translate function do in my code without a textdoman

I am hooking into comment_form_default_fields doing some heavy string replacements. There are translated strings like __( 'Name' ) in there. I need the text. I have two or three different ways to ...
1 vote
1 answer
47 views

Localization inside shortcode not working

I use a shortcode that retrieves the url of woocommerce products and builds a link: function woo_url_shortcode( $atts ) { $atts = shortcode_atts( array( 'id' => null, ), $atts, '...
0 votes
0 answers
232 views

Replace plugin HTML to single text using hooks

I have a plugin that has HTML div that displays like /<div class="llms-setting-group "><p class="llms-label">General Settings(?s).*<\/table><\/div>/ now I want to replace this ...
2 votes
2 answers
752 views

Ajax - gettext without a plugin

How would you go about setting the correct language returned in AJAX calls, when you are not using any plugin? All other strings in page work fine just by defining WPLANG to a proper locale. ...
0 votes
1 answer
326 views

How to use gettext for specific user role

I am trying to replace the publish button text to Submit for review only for specific user role. But I can't find anything which can specify current user role and apply the filter. Here's my code, it'...
1 vote
1 answer
76 views

How to set translations in javascripts for my plugin?

I have in my plugin : form.js : js script to do a custom validation on form fields js_lang.php : based on this stackoverflow post my-plugin-domain-fr_FR.po In form.js, I use a var (msg_must_match) ...
0 votes
1 answer
277 views

Can I set Wordpress to display languages based on system language without a plugin?

This question seems extremely straightforward, but hours of googling have led to no results. Here's the basic gist: I am building a site for Japanese viewers, and am using the theme's language folder ...
0 votes
1 answer
338 views

How to ignore extra whitespaces in translation functions like _e?

I am passing few big strings in my code for translation to _e(). These strings were earlier broken into multiple lines with few leading white spaces before every line to maintain indentation & ...
0 votes
1 answer
2k views

Can't we use strings defined as PHP constants if we want to translate them in a plugin?

I want to translate constant strings in my plugin defined as: define( 'CONSTANT', __( 'string-A', 'textdomain' ) ); And later using it somewhere like: $x= '<h4>'.CONSTANT_NAME.'<h4>'; echo ...
0 votes
1 answer
20 views

How to prevent someone from entering strings without making it available for translation?

I am working to make all strings in my plugin ready for translation by putting them under __() or _e() as per requirement. Now in future to avoid others in my team to add strings without making ...
0 votes
0 answers
200 views

Translation not working for Constant strings in Plugin

I want to translate constant strings in my plugin defined as: define( 'CONSTANT', __( 'string-A', 'textdomain' ) );. The 'string-A' is available for translation and I have uploaded the mo files in the ...
0 votes
1 answer
123 views

How does translation (gettext) work for translating config file of plugin?

I am doing translation of my plugin. I am using __ & _e in php files. But can't figure out how to do same for config file that contains constants added using define(name, value)? Does it ...
3 votes
1 answer
1k views

How does gettext works for translating readme file of plugin?

I am doing translation of my plugin. I am using __ & _e in php files. But can't figure out how to do same for readme.txt file? Is it's content on Wordpress site's plugin page automatically get ...
0 votes
1 answer
33 views

Localization of WP theme

I am working on WP theme localization. On custom search template I have function which gets text of some search terms and replace them with other (just visually). function search_replace_search() { $...
0 votes
1 answer
463 views

Translate a child theme with pure PHP and gettext

I'm trying to translate a child theme of a parent theme that has all msgstr empty. Therefore, I've created the file de_DE.mo using the "WordPress i18n tools" recommended in the docs together with ...
1 vote
1 answer
181 views

Using WordPress gettext functions in a library outside plugin or theme scope

If I have a library available through packagist that could be used in WordPress plugin or theme development, how should I address multilanguage support if I have a few strings that could be localized? ...
1 vote
1 answer
9k views

How can I see my theme's text domain?

Where can I discover my current theme's text domain for use with translation (GetText)?
0 votes
1 answer
384 views

Does WPML translate numbers automatically, or do I have to do the string translation? [closed]

I'm developing my site in English, and when I'm done, I'll be turning it into Arabic. I'm using a function and wondering whether I should wrap it into a gettext call for WPML to get or just leave it ...
0 votes
2 answers
72 views

Using wordpress translations strings in plugin

right now I'm building a helper plugin to make it easier for me to do simple tasks, such as registering post types. When doing this, i'd like to use some of wordpress base translations. Wordpress has ...
0 votes
1 answer
258 views

How to translate "$before" with get text in get_the_term_list?

How can I make $before (Books:) a translateable string <?php echo get_the_term_list( $post->ID, 'book', 'Books: ',', ', ' ', '' ); ?> with this method?: <?php the_content(__('Read more.....
3 votes
2 answers
2k views

Localizing text from XML files

Do you guys know any way I could automatically pick up strings from .xml files and store them in a .po / .pot file, just like PoEdit does with the ones from .php files? The XML structure looks like ...