Articles of textdomain

How to change default text for specific post type

Prelude: Let’s say the text “Comments are closed” is a default WP String and you wanna change that text string to something else like “Hello World!” if is_singular(‘post-type’) is true. Issue: Now, I do know that there is a plugin called Say What? which does this exact thing, you just have to provide the string […]

load_child_theme_textdomain doesn't work in function.php

I have a child theme which is not localized. So I added this in function.php add_action( ‘after_setup_theme’, ‘my_child_theme_setup’ ); function my_child_theme_setup() { load_child_theme_textdomain( ‘mytheme’, get_stylesheet_directory() . ‘/languages’ ); } It doesn’t work. I searched for hours and I read somebody advised putting this to the top of header.php load_child_theme_textdomain( ‘mytheme’, get_stylesheet_directory() . ‘/languages’ ); Suddenly […]

How can I see my theme's text domain?

Where can I discover my current theme’s text domain for use with translation (GetText)?

How to solve a translation function issue with no arguments and missing a text-domain?

I have a warning via WordPress Themecheck plugin WARNING : Found a translation function that is missing a text-domain. Function esc_html__, with the arguments As you can see, there is no arguments listed above and I’m really lost on this. Here’s the code function: <?php wp_nonce_field( basename( __FILE__ ), ‘matilda_featured_image_nonce’ ); $selected = esc_html__( get_post_meta( […]

Should all references to a text domain be to my current theme?

I’m running Theme Check on a theme I’ve inherited and I’ve come across lots of recommendations like this one: RECOMMENDED: Text domain problems in loop.php. The twentyten text domain is being used! The site has no plans for being translated, so what’s the best thing to do in this situation? Replace every reference to twentyten […]

Theme doesn't want to load localization files

Here is my functions.php excerpt: function get_theme_text_domain() { //Same behavior if I return the string as ‘return ‘whatever’ $theme = wp_get_theme(); return $theme->get(‘TextDomain’); } function tamtando_theme_setup() { load_textdomain(get_theme_text_domain(), get_template_directory() . ‘/languages’); […] } add_action(‘after_setup_theme’, ‘tamtando_theme_setup’); $theme is an array with all theme’s properties: as expected. $theme->get(‘TextDomain’) returns ‘tamtando’: as expected. I’ve noticed that the theme […]

WordPress Theme .mo-file won't load

I am developing a theme that implements multiple languages. I have a few strings that will have to be translated in the theme itself. I would like to use a .po and .mo file. For some reason, when I try to load the files, they don’t load properly and I have no idea why. I […]

Does the textdomain have to be the theme's name?

Does a theme’s text domain have to be the actual theme name? If you develop WP themes, couldn’t you just use the same name (perhaps your business name) for all the theme’s you develop, making it easier to copy and paste code as you develop? (even though a find and replace is rather simple).

Use WordPress default text domain for translating labels

I am wondering if there is a way to use the “default” text domain (“WordPress” or “default”) to translate labels. E.g I have following code: // Register Custom Taxonomy function custom_taxonomy() { $labels = array( ‘name’ => _x( ‘Press category’, ‘Taxonomy General Name’, ‘my_text_domain’ ), ‘singular_name’ => _x( ‘Press category’, ‘Taxonomy Singular Name’, ‘my_text_domain’ ), […]

Use the wp-admin translations on the front end

Currently I’m working on implementing the user profile form on the front end. Unfortunately the front end core translation file (wp-content/languages/lang_LANG.po) doesn’t have any of the translated strings displayed on the user profile page. Those translated strings are located in wp-content/languages/admin-lang_LANG.po and since the filename starts with “admin”, my best guess is that this only […]