Questions tagged [xgettext]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
16 views

Get all strings from all plugins

I'm trying to develop a plugin to override any translation from any plugin directly from wp-admin. In order to do this, I need to get the strings from any given plugin, and also the translations (in ...
1
vote
0answers
57 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
1answer
99 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
1answer
46 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
1answer
60 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
1answer
60 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
1answer
392 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
1answer
19 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
0answers
59 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
1answer
51 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 ...
1
vote
1answer
283 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
1answer
24 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
1answer
280 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
1answer
133 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? ...
0
votes
1answer
3k 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
1answer
329 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
2answers
37 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
1answer
214 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
2answers
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 ...