Skip Navigation

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.

This topic contains 7 replies, has 3 voices.

Last updated by Asha Patel 1 year, 1 month ago.

Assisted by: Andreas.

Author Posts
February 21, 2023 at 5:27 am #13075345

Asha Patel

I have added custom code to show login & register (header home page) button and both have href links. In another language, the href links must translated. how to achieve the same?

Site link: hidden link

custom login register.png
February 21, 2023 at 7:33 am #13075787

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

For these to be translatable, the following conditions have to be met:

- The text must be wrapped in gettext calls.
-There must be a textdomain argument.

For example:

$url = __( '<em><u>hidden link</u></em>', 'my-domain' );
 
printf(
    esc_html__( 'By clicking on "Create an account" below, you are agreeing to the %sTerms of service%s', 'my-domain' ),
    '<a href="' . $url . '">',
    '</a>'
);

Please check our documentation and this for further info and more examples:

- https://wpml.org/documentation/support/enabling-text-translation-for-themes-not-compatible-with-wpml/

Kind regards,
Drazen

February 22, 2023 at 4:56 am #13084865

Asha Patel

I tried from this link https://wpml.org/documentation/support/enabling-text-translation-for-themes-not-compatible-with-wpml/ but not getting translations. Can you please guide me on my code that how to write it? The title is also not translated.

MicrosoftTeams-image (22).png
February 22, 2023 at 11:33 am #13088109

Andreas

Thank you very much for your efforts.

May I ask you to tell me exactly where this file is located and describe exactly the steps you did in order to scan for new strings?

Regards,
Andreas

February 22, 2023 at 12:05 pm #13088435

Asha Patel

The location of file : Appearance -> Theme File Editor -> change theme to 'snowlake' -> header-style-5.php

I tried to find out the href text into WPML -> string translations

February 22, 2023 at 12:06 pm #13088437

Asha Patel

The file name is incorrect. the correct file name: header-style5.php

February 22, 2023 at 1:07 pm #13089301

Andreas

Thank you for your explanation.

Just for clarification :

After you updated the file, did you rescan theme files in order String Translation Read the updated string ?

Please read more here :
https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/

Regards,
Andreas

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.