This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

You are not logged in. You can view support threads, but not post.
If you are already logged in, please refresh your browser.

Tagged: 

This topic contains 6 replies, has 3 voices, and was last updated by  Ahmed Mohammed 1 year, 11 months ago. The support staff assigned to this topic is Ahmed Mohammed.

Author Posts
Author Posts
October 27, 2015 at 12:23 pm #733538

matsH

Hello sir/miss,

I'm a theme developer and I wish to offer full WPML support.
Right now the only issue I have is to translate the get_theme_mod calls in my files. I have already checked other threads but they didn't answer my question yet.

Example of customizer use in one of my themes:

This is the control in the customizer.php file

	$wp_customize->add_setting( 'theme_customizer_headertextlineone', array(
		'sanitize_callback' => 'sanitize_text_field'		
	) );

	$wp_customize->add_control( new WP_Customize_Textarea_Control( $wp_customize, 'theme_customizer_headertextlineone', array(
		'label' => __( 'Intro header', 'section' ),
		'section' => 'theme_customizer_headertext',
		'settings' => 'theme_customizer_headertextlineone',
		'priority' => 1
	) ) );

This is that setting echo'd on the front end

<?php if ( get_theme_mod('theme_customizer_headertextlineone') && is_front_page() ) { ?>
<?php echo esc_textarea(get_theme_mod( 'theme_customizer_headertextlineone'));?>
<?php } ?>

I tried to solve the issue with a wpml-config.xml file but to no avail:

<wpml-config>
    <admin-texts>
        <key name="theme_mods_landy">
            <key name="theme_customizer_headertextlineone" />
        </key>
    </admin-texts>
</wpml-config>

As you can see I have sub sections inside panels inside of the customizer (not sure if this changes the values in the wpml-config.xml file). Could you nudge me in the right direction? Much appreciated!

Kind regards

October 30, 2015 at 9:48 am #736185

Ahmed Mohammed
Forum moderator

Supporter Timezone: Europe/Rome (GMT+01:00)

Thank you for contacting WPML support and sorry for the unintentional delayed reply. I think the issue is coming from your wpml-config.xml file. As you mentioned, you have sub sections, so you may need to try this wpml-config.xml file

<wpml-config>
    <admin-texts>
        <key name="theme_mods_landy">
            <key name="theme_customizer_headertext">
                 <key name="theme_customizer_headertextlineone" />
             </key>
        </key>
    </admin-texts>
</wpml-config>

This should be working, if you still have issue, could you please give me a copy of your theme to debug it on our servers ?
I'll mark the next reply as private in case you're posting the download link of your theme.

October 30, 2015 at 11:32 am #736284

Ahmed Mohammed
Forum moderator

Supporter Timezone: Europe/Rome (GMT+01:00)

You're right, there's something wrong with the current version of WPML 3.2.7. I've test the following wpml-config.xml file with the dev version of WPML 3.3 and it's working without problems.

<wpml-config>
	<admin-texts>
		<key name="theme_mods_Landy">
			<key name="theme_customizer_headertextlinetwo"/>
			<key name="theme_customizer_headertextlineone"/>
		</key>
	</admin-texts>
</wpml-config>

As a workaround with the current version, you can add those strings to string translation table by going to WPML->> String Translation Page -> then click on "Translate texts in admin screens »" at the end of the page. Then follow the attached screenshot. It'll add the string to the String Translation table. When WPML 3.3 is released, the above wpml-config.xml file will be working without doing those extra steps to include the strings in the string translation table.

Please let me know if you have any further comments/questions.
Thanks!

November 14, 2015 at 11:57 am #746459

matsH

Thanks!

January 13, 2016 at 12:43 pm #786844

nicolasG-23

Hello,

I've a question in same subject.

I've this code to add theme options :

$wp_customize->add_section(
        'perso',
        array(
            'title' => 'Personnalisation du thème',
            'priority' => 1,
        )
    );

    /* Nom et titre du folio */
	$wp_customize->add_setting('portfolio_firstname');
    
    $wp_customize->add_control(
    'portfolio_firstname',
    array(
        'label' => 'Prénom',
        'section' => 'perso',
        'type' => 'text'
    ));

I use string translation plugin to translate string but I can't see this setting in string translation part.

Is it normal ?

January 13, 2016 at 2:09 pm #786929

nicolasG-23

So, I've understood your post... and add config file with

<wpml-config>
	<admin-texts>
		<key name="my_plugins_options">
        	<key name="portfolio_firstname"></key>
    	</key>
    </admin-texts>
</wpml-config>

and go to admin string part but can't see it.

January 13, 2016 at 4:16 pm #787124

Ahmed Mohammed
Forum moderator

Supporter Timezone: Europe/Rome (GMT+01:00)

@nicolasG-23, could you please open another ticket so that one of our supporters could help you with your issue ?

Probably, it's coming from this line

<key name="my_plugins_options">

You are not logged in. You can view support threads, but not post.
If you are already logged in, please refresh your browser.