Localization, escape html elements mid-sentence

I’d use printf to put the markup into place after the translation. You can force the order with the right modifiers, but translators are probably smart enough to not really need that. printf( __(‘The image %sMUST%s be less than %s500 KB%s in size.’, CUSTOM_TEXT_DOMAIN), ‘<em>’, ‘</em>’, ‘<strong>’, ‘</strong>’ ) ; I consider Otto’s post to … Read more

Using wordpress translations strings in plugin

Turns out that wordpress uses context strings for this piece of text: _x(‘Add New’, ‘post’) and _x(‘Add New’, ‘page’) This is because the string ‘Add New’ is different depending on the following noun in some languages. i.e in Danish: ‘Add New Post’ => ‘Tilføj Nyt Indløg’ ‘Add New Page’ => ‘Tilføj Ny Side’. Notice the … Read more

WordPress Translation Issue

You are exploding the text with explode( ‘ ‘, $ctxttext ). Therefore you are translating word by word, not strings. That is why it’s working with single word string, and not with multiple words. When you call First Name you are translating First and Name. Cheers

Return Value of load_plugin_textdomain

global $langOK; add_action( ‘plugins_loaded’, ‘myplugin_load_textdomain’ ); function myplugin_load_textdomain() { global $langOK; $langOK = load_plugin_textdomain( ‘my-plugin’, false, dirname( plugin_basename( __FILE__ ) ) . ‘/languages’ ); } Later you can check the value of $langOK ( TRUE = success, FALSE = failure ).

Conflict with single and double quotes

It’s sometimes easier to work with sprintf(): ‘Default’ => sprintf( ‘<img src=”https://wordpress.stackexchange.com/questions/213508/%s/admin/images/default.png” width=”120″ height=”80″ alt=”%s” />’, get_template_directory(), esc_attr__( ‘Default’, ‘my_theme’ ) ); where we use the esc_attr__() to return a translated value that’s safe to be used in an attribute, but I’m not sure what your THEMEROOT contains, so I just replaced it with get_template_directory().

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)