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.

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Bruno Kos 1 month, 1 week ago.

Assigned support staff: Bruno Kos.

Author Posts
September 8, 2019 at 6:17 pm #4532311

amitP-2

Tell us what you are trying to do?
I have sentences that have different structure when translating and would like to know how to build them in PHP.

Is there any documentation that you are following?
string translation is good for most cases, but not for this case.

Is there a similar example that we can see?
for example, in English: What gaming software does xxx use?
but in thai: ผู้ให้บริการเกมส์ซอฟแวร์ xxx?
notice the xxx is in a different place...
xxx is a post name, so it is being translated there.
I don't want to use __('What gaming softwares does ','sfgroup').$title.__(' use?','sfgroup') and __('What gaming softwares does '.$title.' use?,'sfgroup') means I will need to translate each post I upload as a string again...

should I continue to try and use string translation, or should I hardcode the translation and use switch with icl_language to display the correct translation?

What is the link to your site?
hidden link

September 8, 2019 at 6:25 pm #4532385

amitP-2

Sorry, just to make it more clearer:
english: What gaming softwares does xxx use?
other langualge example: What gaming softwares used by xxx?

September 8, 2019 at 6:45 pm #4532401

amitP-2

Can you also please make this post anonymous :)?

September 9, 2019 at 12:29 pm #4537103

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

Thank you for contacting WPML support!

or should I hardcode the translation and use switch with icl_language to display the correct translation?

I think this is a way to go, based on what you are seeking here. WPML or namely the string translation will not be able to change the order of words. However, I suggest you try working with https://wpml.org/wpml-hook/wpml_current_language/

See this answer:
https://wpml.org/forums/topic/icl_language_code-vs-wpml_current_language-filter/#post-1324568

Also, examples here:
https://wpml.org/forums/topic/php-error-ificl_language_codeen/#post-2111534
https://wpml.org/forums/topic/cannot-change-language-programmatically-for-wc-countries/#post-4422477

Hopefully these will help 🙂

As for hiding this topic, we cannot hide it (make it private), but nobody except you or WPML supporters will be able to see any of the links you posted nor any of your private information:
https://wpml.org/forums/users/amitp-2/ (you can check it from the browser where you're not logged in).

Regards,
Bruno Kos