Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
I am building a WP theme in Spanish and the default language of the site is Spanish, but some strings added to the code in Spanish are showing the source language as English in WPML > String Translation.

Solution:
This happens because the string was added to the code in a language other than English, you can change the source language of the strings in WPML > String Translation by selecting the string then clicking the "Change language of selected strings" button.

Relevant Documentation:
https://wpml.org/documentation/getting-started-guide/string-translation/how-to-change-the-source-language-of-strings/

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 2 replies, has 2 voices.

Last updated by Ferran 1 year, 5 months ago.

Assisted by: Mohamed Sayed.

Author Posts
May 26, 2023 at 11:03 am #13722517

Ferran

Tell us what you are trying to do?

I am building a WP theme in spanish and I've already set up the whole WP environment and WPML default language in spanish, so I am adding the php code like so in, for instance, the template-home.php file:

<p><?php esc_html_e( 'Aprende español', 'BHS' ); ?></p>

(which means 'Learn Spanish')

then I go to the backoffice > WPML > themes and plugins location
to find all the strings and after that I go to STRING TRANSLATION

but I am seeing the flags in the wrong position (please find a screenshot attached)

Maybe I am doing something wrong or I forgot to define or declare something?
or it is mandatory to add the texts in the code only in english?

Is there any documentation that you are following?
No

Is there a similar example that we can see?
No

What is the link to your site?
it is a local site using MAMP

Screenshot 2023-05-26 at 1.00.07 pm.jpg
May 26, 2023 at 6:07 pm #13724909

Mohamed Sayed

Hi Ferran,
Thanks for contacting WPML support, I will be glad to help you.

This happens because the string was added to the code in a language other than English, you just need to change the source language of the strings in WPML > String Translation as mentioned here: https://wpml.org/documentation/getting-started-guide/string-translation/how-to-change-the-source-language-of-strings/

Regards,
Mohamed