No supporters are available to work today on this forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 3 replies, has 2 voices.

Last updated by Otto 1 year, 1 month ago.

Assigned support staff: Otto.

Author Posts
September 15, 2018 at 4:20 am #2737251

Sven Olaf Loerz

What are you trying to translate?
Comment: We have created some custom strings in plugin and theme as well that need to be translated.

What are you seeing? (please include a screenshot)
The custom string needs to be translated.

What's missing or not working for you?
I have moved the website for testing purpose in a sub-folder, but after that language switcher stops working, link on language switcher showing the same link on every page and didn't translate anything except WordPress default menus, pages etc... but not custom strings.

All strings are showing on WPML string translation with Translation Complete status but not reflecting on the website when I translate the page with language switcher.

Can you please help me to fix that issue, It also showing below warning when I check WPML. Please check attached screenshot.

[REMOVED]

September 16, 2018 at 1:00 am #2738130

Otto
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

The custom strings added in the theme need to be wrapped into gettext functions:
https://codex.wordpress.org/Plugin_API/Filter_Reference/gettext

Then, provided that you have the "WPML String Translation" AddOn installed please follow these steps:
- Go under "WPML -> Theme and plugins localization".
- Make sure that "Translate themes and plugins using WPML's String Translation only (don't load .mo files)" is active.
- Scroll down to "Strings in the theme" and click on "Scan the theme for strings".
- Scroll down to "Strings in the plugins", select the plugin you want to scan and click on "Scan the selected plugins for strings".
- Once you followed the above steps go under "WPML -> String Translation". All strings available for translation should display in the table you see there.

Do you see them? If yes, all you need to do is click on "translations" next to each string you want to translate and enter + save your translations.

Documentation:
https://wpml.org/documentation/getting-started-guide/string-translation/

Let me know if this helps, please.

Kind regards,

Otto

September 17, 2018 at 4:44 am #2739617

Sven Olaf Loerz

Hi,

Thanks for your reply.

I have checked your steps and once I check 'Translate themes and plugins using WPML's String Translation only (don't load .mo files)' in the respective area, it shows me error Error: data not saved (See attached screenshot).

Can you please help me more to fix that issue.

Whenever you logged in admin and go to hidden link page then after translating the page you can see that WordPress menus and other text are translated but when you scroll down, then you can see
- Reservation Details
- Input fields (Room, Number of guests, Total etc...) are not translated.
Same things are happed for other pages

I also followed https://codex.wordpress.org/Plugin_API/Filter_Reference/gettext for custom string, please check screenshot and let me know if I am doing anything wrong.

[REMOVED]

Waiting for your reply.

Thanks

September 17, 2018 at 12:06 pm #2740782

Otto
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

I removed the credentials. Please take into account that this is a public forum, so they have been exposed for some hours. I suggest you change them.

The gettext implementation in not OK. The second parameter, text domain, should be a string so it should be encloces in quotes, i.e.:

'price' => __('Price', 'my-custom-text-domain') 

After scanning you should be able to translate those strings in WPML > String Translation.

Let me know your results, please.

Kind regards,

Otto

The topic ‘[Closed] String translation of website in sub-folder not working’ is closed to new replies.