Countdown labels doesnt translate in poedit

Hello,
tried to change the labels “days”, “hours” (…) in the countdown using poedit following the info here https://theme.co/docs/theme-translations but i didnt achieve what i wanted. Is there any css code to only change that labels?

thank you

Hey @juliana,

Regretfully, the only way to translation options based text is to use WPML. You will need to translate the whole page manually using WPML and the translation flags available in the builders.

For more details, please see https://theme.co/docs/wpml

Hope that helps.

Hi, @christian
thats a pity… I will definitely not install a huge plugin like WPML if my site its only 1 language. With so many settings options on the left bar on the editor, don’t understand why those labels doesnt have fields to edit those strings…

Hello @juliana,

Which Countdown you are referring to? Is it the Countdown element or the countdown in the Under Construction extension? Be advised that the labels in both elements and the plugin were hardcoded and cannot be translated.

Best Regards.

Hi!,
yes the countdown element. note that I dont want to translate I just want to change the actual label because is in english.

Hey @juliana,

I’m very sorry for the confusion. I checked the Countdown element deeper and it is translatable. It’s under the cornerstone Text Domain and it’s not available in the POT file.

image

To translate it, follow the Single Sentence Translation, described in our Translation article here https://theme.co/docs/theme-translations

The code you need is as follows.

add_filter(  'gettext',  'wps_translate_words_array'  );
add_filter(  'ngettext',  'wps_translate_words_array'  );
function wps_translate_words_array( $translated ) {
 
     $words = array(
            // 'word to translate' = > 'translation'
            'Days' => 'Days Translation',
            'Day' => 'Dias',
            'Hours' => 'Text',
            'Hour' => 'Text',
            'Minutes' => 'Test',
            'Minute' => 'Test',
            'Seconds' => 'Test',
            'Second' => 'Test',
            );
 
     $translated = str_ireplace(  array_keys($words),  $words,  $translated );
     return $translated;
}

The code should work provided that it’s copied completely as I’ve tested it before posting here.

image

Hope that helps.

hello @christian I will try this today, thanks for that :slight_smile:

Hi @juliana,

Please let us know how it works for you.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.