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

Last updated by markusH-36 1 year, 4 months ago.

Assigned support staff: Bruno.

Author Posts
May 26, 2018 at 3:09 pm #2233659

markusH-36

Tell us what you are trying to do?

I need hardcoded words changed (in my example its: "door count" changed to "kilometer per day incl" or "Kilometer pro Tag inkl".

As I understand, I need to make a dummy language (in my case it's "US" and it has no flag). it's hidden (but shows for admin, because I wanted to test what it does).

I go German, then I get the correct translation. I go English, and it does not translate it. I go US (only shown to admin) and I get the German translation (what is odd, because I expect it to be the original string "door count").

from theme support I got this: I think the issue here concerns whether you are loading your "translated" English language in the frontend website or the default English language.
Are you sure the correct English language is being loaded?

Switching menus (pages and posts that I duplicated and translated with WPML) and widgets (a widget for each language) it works perfectly!

but for the type of strings I sent you, it's not working. 🙁

Any idea why? your help and support is highly appreciated!! 🙂

Best regards and have a nice day!

Markus

What is the link to your site?

site not published yet, but could provide login info, if you can't help me that way.

May 29, 2018 at 2:29 am #2242639

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

Thank you for contacting us. Please, my sincere apologies for the delay in answering.

From what I understand, you're wanting to add a new language so that you can translate to other languages and even change the default language string. Is this right?

If so, ideally, you should create a child theme (https://codex.wordpress.org/Child_Themes) and change the desired string via PHP code. That is, open and edit the file directly. That way you would not need to "create a language" to try to edit the strings.

This would be the correct way to change the default language string - directly by code. Also, for a new string to appear, you may need to scan your theme. To do this, follow the steps below:

- Click on the WPML > Theme and plugins localization
- Scroll down and look for "Strings in the themes"
- Select the child theme
- Click on the "Scan selected themes for strings" button

Following these steps, you should have a new string (changed in code) and registered in the WPML > String Translation for translation.

Please, let me know if I can help with any other questions you may have. I'll be happy to help.

Thank you.

May 29, 2018 at 6:34 am #2242993

markusH-36

Dear Bruno,

Thanks for your fast reply!

I do have a child theme and I copied some php-files there to change the code to remove some features of the theme (I removed them later trying to fix the issue, but this didn't work).

You are right about what you're saying with changing the strings in the php-files in the child theme, but I could not update the theme correctly then, because the php-file with the new version would be overwritten by the "old" php-file in the child theme with the translated strings.
So the theme support suggested to install WPML and translate the strings this way, because then they are stored within WPML and I can update the theme without loosing my work.

therefore I prefer the translation with the "dummy" language if it works.

I'm scanning the strings, but it still didn't finish and I'm traveling at the moment and have to leave. So maybe scanning takes an insane amount of time or the internet is too slow here, but in any case, I will need to start over again.
But I attached you a screenshot of the settings.. please tell me:

1) does it make sense to use the .mo files as backup?
2) to me the strings don't seem to be getcall, but maybe there lies the problem (should I tick that box).
3) is the "assume original language is English" messing with something? basically it is.. only that I switch some original strings to my dummy language, so I can change the hard-coded strings from e.g. "car" to "bike"
4) is the yellow "needs to be updated" somehow relevant? I find these strings when I look for them (sure to have the right one, as the German translation works.. only the english text does not show up).

summarized, I hope you can fix my problem or at least confirm the settings with this screenshot. also from the older screenshots I sent, you might be able to tell me why the German translation is loaded correctly, but the English translation is not. I have quite some strings translated already and once the issue is fixed, they should all work properly.

I highly appreciate your help! WPML is a great tool and you're giving awesome support with it! 😀

have a nice day and best regards!

Markus

May 31, 2018 at 2:12 am #2253993

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi Markus,

Thank you and sorry for the delay.

You are right about what you're saying with changing the strings in the php-files in the child theme, but I could not update the theme correctly then, because the php-file with the new version would be overwritten by the "old" php-file in the child theme with the translated strings.

The goal of the child theme is to keep the content "personalized/customized", even if the parent theme is updated. That is, even updating the parent theme, this should not affect the child theme and its change.

>>> 1) does it make sense to use the .mo files as backup?

That depends. Usually, clients use the first option, "Translate themes and plugins using WPML's String Translation only (don't load .mo files)".

This is useful if you want to update some strings, but not all strings, for example. Then you use the mo file translation for the strings that were not translated by String Translation.

>>> 2) to me the strings don't seem to be getcall, but maybe there lies the problem (should I tick that box).

I do not think this is related to the initial question you posted. This option will simply load WPML and the mo files so that a string is translated, even if it has not been translated into String Translation - as long as it is actually translated into the mo file.

>>> 3) is the "assume original language is English" messing with something? basically it is.. only that I switch some original strings to my dummy language, so I can change the hard-coded strings from e.g. "car" to "bike"

This only means that the original hard-coded strings are in English. This makes WPML not to attempt to load multiple languages in the default language - as this is not necessary.

>>> 4) is the yellow "needs to be updated" somehow relevant? I find these strings when I look for them (sure to have the right one, as the German translation works.. only the english text does not show up).

This only shows strings that have not yet been translated or the original string has changed. These strings receive the status of "needs updating"

Please, let me know if I can help with any other questions you may have. I'll be happy to help.

Thank you.

May 31, 2018 at 4:26 pm #2257704

markusH-36

it was a tick box of default English.. but the support was fast, so I appreciate the help 🙂