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.

Our next available supporter will start replying to tickets in about 6.49 hours from now. Thank you for your understanding.

This topic contains 3 replies, has 2 voices.

Last updated by olegV 11 months, 4 weeks ago.

Assigned support staff: Riffaz.

Author Posts
October 15, 2018 at 5:35 pm #2818460

olegV

I am trying to: display the button for "Related Posts" in English and Russian on the respective language versions of the site. It's a JetPack module which does not behave like other plugins where I can choose Language Picker. I can rename the button to include both languages ("Related Posts/Похожие записи"), but that's less than ideal solution.

Link to a page where the issue can be seen: hidden link

I expected to see: "Похожие записи" where "Related Posts" is displayed.

Instead, I got: English version on both languages

October 16, 2018 at 8:42 am #2820132

Riffaz
Supporter

Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)

Hi Oleg,

Thank you for contacting WPML support.

Have you translated these string in WPML > String Translation : hidden link ?

Try to scan the string as explained here https://wpml.org/documentation/getting-started-guide/theme-localization/#scanning-plugins-for-texts and search then search that string in WPML > String Translation

If non-of these work for you please add this code to the very bottom of Appearance > Editor > functions.php

add_filter( 'gettext', 'wpml_jetpack_relatedpost_title_text', 20, 3 );
function wpml_jetpack_relatedpost_title_text( $translated_text, $text, $domain ) {

  if ( !is_admin() ) {
	if(ICL_LANGUAGE_CODE == 'ru'){
      switch ( $translated_text ) {
          case 'Related Posts' :
              $translated_text = __( 'What you prefer', 'jetpack' );
              break;
      }
	}  
  }
  return $translated_text;
}

Replace "What you prefer" with the text you want.

Let me know which one works for you please.

Regards,
Riffaz.

October 16, 2018 at 10:14 am #2820519

Riffaz
Supporter

Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)

Hi Oleg,

We found a small correction for this.
The right way to do this is adding the following xml code to WPML > Settings and click on the tab "custom XML configuration" :

<wpml-config>
  <admin-texts>
    <key name="jetpack_relatedposts">
      <key name="headline"/>
    </key>
  </admin-texts>
</wpml-config>

Refer : https://wpml.org/documentation/support/language-configuration-files/#using-wpml-language-configuration-file-with-child-themes

October 26, 2018 at 7:31 pm #2854142

olegV

Hi Riffaz!
Here is what I've done...
Custom XML configuration: I followed your second set of instructions to update "custom XML configuration". Unfortunately, it did not cause the desired effect on my posts.

String Translations: I've checked String Translations>Jetpack domain>Related Posts. I found several of them, but for all of them the translation was complete with correct "Похожие записи". Nevertheless, I updated each of them and forced to use my translation. It did not work...

Then I searched for "related posts" in String translation without limiting to "Jetpack" as the domain. And found this

Domain: admin_texts_jetpack_relatedposts Name: [jetpack_relatedposts]headline

this one was not translated. After providing translation, it worked.

Thank you!
Oleg