• Hi,

    I don’t really understand how to translate my static items.

    My whole homepage is static because otherwise it would be impossible to have this design.

    Here is what I want to translate:

    This is home-made customization in the WordPress admin panel.

    I also have all of this which is hardcoded into my theme.

    The problem is that I don’t see how I can translate that.

    How am I suppose to do that? I was expecting the plugin to scan my whole website for <p> and <h> tags to be able to translate manually.

    Thank you

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter Nic727

    (@nic727)

    ok, I’ve found that the other plugin to translate theme is working for most of the static text.

    However, I’m unable to understand how to be able to translate the dynamic text entered via the customization panel.

    My functions.php

    $wp_customize->add_setting( 'main_title', array(
            'type' => 'theme_mod',
            'default' => '',
            'sanitize_callback' => $pgwp_sanitize
        ));
    
        $wp_customize->add_control( 'main_title', array(
            'label' => __( 'Titre principal', 'aurora' ),
            'type' => 'text',
            'section' => 'aurora_default_cs'
        ));
    
        $wp_customize->add_setting( 'sub_title', array(
            'type' => 'theme_mod',
            'default' => '',
            'sanitize_callback' => $pgwp_sanitize
        ));
    
        $wp_customize->add_control( 'sub_title', array(
            'label' => __( 'Sous-titre', 'aurora' ),
            'type' => 'text',
            'section' => 'aurora_default_cs'
        ));
        // Register strings for translation
        function register_theme_strings() {
            pll_register_string('aurora', get_theme_mod('main_title'), 'aurora', true);
            pll_register_string('aurora', get_theme_mod('sub_title'), 'aurora', true);
        }
        add_action('init', 'register_theme_strings');

    And in my front-page.php

    <div class="home-title"> 
                <h1><?php echo pll__(get_theme_mod( 'main_title' )); ?></h1> 
                <h2><?php echo pll__(get_theme_mod( 'sub_title' )); ?></h2> 
            </div>  

    I don’t see anything in the main translation interface to translate the string appearing there.

    What did I do wrong?

    Thank you!

Viewing 1 replies (of 1 total)
  • The topic ‘How to translate static items?’ is closed to new replies.