Handling gettext / string translation when WP is installed in subfolder
Handling gettext / string translation when WP is installed in subfolder
Handling gettext / string translation when WP is installed in subfolder
First, you should have to register your custom post type with a generic, language-independent slug because the slug in register_post_type is not meant to be dynamic. and then modify rewrite rule try this snippet function register_custom_post_type_services() { $labels = array( ‘name’ => _x(‘Services’, ‘Post Type General Name’, ‘text_domain’), ‘singular_name’ => _x(‘Service’, ‘Post Type Singular Name’, … Read more
Finally I found the issue! The following filter was causing the theme to only translate partially: function howdy_message($translated_text, $text, $domain) { $new_message = str_replace(‘Howdy’, ‘Aloha’, $text); return $new_message; } add_filter(‘gettext’, ‘howdy_message’, 10, 3); I replaced it with the following that now works: function howdy_message($translated, $text, $domain) { if (false !== strpos($text, ‘Howdy’)) return str_replace(‘Howdy’, ‘Aloha’, … Read more
How to translate to a language different than the current one?
Confirm that the translation functions are being loaded. Sometimes, issues with function loading can prevent translations from working. Basic example of loading translations in your theme’s functions.php file function my_theme_load_textdomain() { load_theme_textdomain( ‘my_theme’, get_template_directory() . ‘/languages’ ); } add_action( ‘after_setup_theme’, ‘my_theme_load_textdomain’ );
Translate string in another langage than Locale
How to correct translation error in WP Astra Taxonomy block
I’m still not sure why this problem occured. I’m guessing the class loads before the WordPress translation functions do. I ended up circumventing the problem by using functions instead of variables: function ins_banister_right(): string { return __( “Rampe d’escalier à droite”, ‘co_product_configurator’); } function ins_banister_left(): string { return __( “Rampe d’escalier à gauche”, ‘co_product_configurator’); } … Read more
Plugin for translation from one account and posting in different account
It seems like you do not have any JavaScript localization files to use with wp_set_script_translations(). If we consult the Gutenberg/JavaScript documentation for internationalization: The translation files must be in the JED 1.x JSON format. […] <?php function myguten_set_script_translations() { wp_set_script_translations( ‘myguten-script’, ‘myguten’, plugin_dir_path( __FILE__ ) . ‘languages’ ); } add_action( ‘init’, ‘myguten_set_script_translations’ ); WordPress will … Read more