Questions tagged [xgettext]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
38 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 ...
user avatar
0 votes
0 answers
7 views

How to find which .mo file is responsible for displaying a particular localized string?

Is it possible to find it out by examining the source code or by using the developer feature Inspect (like a style and its corresponding .css)? I know I can copy the entire content of the site and ...
user avatar
  • 1
0 votes
0 answers
38 views

Gettext: Specify base language for translatable strings?

I have plenty of customizations on a page which was only meant to be used for german audience - hence I hardcoded the some German sentences directly into the functions.php whereever I had language ...
user avatar
  • 152
1 vote
1 answer
39 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, '...
user avatar
0 votes
0 answers
106 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 ...
user avatar
  • 68
2 votes
2 answers
553 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. ...
user avatar
0 votes
1 answer
251 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'...
user avatar
1 vote
1 answer
66 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) ...
user avatar
  • 770
0 votes
1 answer
169 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 ...
user avatar
0 votes
1 answer
264 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 & ...
user avatar
0 votes
1 answer
1k 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 ...
user avatar
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 ...
user avatar
0 votes
0 answers
142 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 ...
user avatar
0 votes
1 answer
89 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 ...
user avatar
2 votes
1 answer
940 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 ...
user avatar
0 votes
1 answer
29 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() { $...
user avatar
0 votes
1 answer
449 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 ...
user avatar
1 vote
1 answer
160 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? ...
user avatar
  • 1,734
0 votes
1 answer
7k 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)?
user avatar
0 votes
1 answer
379 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 ...
user avatar
  • 397
0 votes
2 answers
64 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 ...
user avatar
  • 569
0 votes
1 answer
251 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.....
user avatar
  • 395
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 ...
user avatar
  • 13.5k