Localizing text from XML files

You should use a localized XML format like XLIFF or TMX , there is a tool to convert XLIFF to .po. If you cannot change the source XML you have a few options but it really depends how your outputting this XML info: Parse the XML ( for label) and create a .po with gettext … Read more

How to use is_rtl with my main style.css?

In your theme, you enqueue the stylesheet usually like this: add_action( ‘wp_enqueue_scripts’, ‘t5_enqueue_style’ ); function t5_enqueue_style() { wp_enqueue_style( ‘theme-name-default’, get_template_directory_uri() . ‘/css/default.min.css’ ); } The extra RTL stylesheet is enqueued here too, listing the default as dependency: if ( is_rtl() ) { wp_enqueue_style( ‘theme-name-rtl’, get_template_directory_uri() . ‘/css/rtl.min.css’, array ( ‘theme-name-default’ ) ); } So the … Read more

How do I override a parent theme’s language files with a child theme?

you may use this below code for your problem: [1]: https://i.stack.imgur.com/5aX1D.png or use below code: add_action( ‘after_setup_theme’, function () { load_theme_textdomain( ‘your parent theme name’, get_stylesheet_directory() . ‘/languages/’ ); load_child_theme_textdomain( ‘your child theme name’, get_stylesheet_directory() . ‘/languages’ ); } );

Best pratice to make taxonomy terms translatable without changing slugs?

I’m not really up to date on WPML and how it handles translations, but my general understanding is that in most cases it simply creates duplicate entries for each language and links them together with the “original”. However, I recently hade a similar problem where I needed the ability to add a “pluralized” version of … Read more

How to i18n slugs for templates?

Filter template_include: add_filter( ‘template_include’, ‘prefix_translate_template’ ); function prefix_translate_template( $template ) { if ( ‘category-‘ . __( ‘news’, ‘your_textdomain’ ) . ‘.php’ === $template ) return ‘category-news.php’; return $template; } But I think templates based on slugs are not a good idea in that case.

How to escape single and plural i18n text strings?

esc_html_e() and esc_attr_e() are merely wrapper functions for _ to save a little bit of typing and help with readability. You’re right, there isn’t one for _n, so you’ll just need to do the “wrapping” yourself: printf( esc_attr( _n( ‘%s item’, ‘%s items’, $count, ‘textdomain’ ) ), number_format_i18n( $count ) );

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