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

Last updated by Diego Pereira 1 year ago.

Assigned support staff: Diego Pereira.

Author Posts
September 26, 2018 at 12:11 pm #2767136

bomannN

We have a wordpress multi-site setup and created a front-end translation table that consists of all strings just like the WPML string translation table in the back-end.
The user can add translations using icl_add_string_translation to update strings.
Since we have a multisite and want to translate across all sites, we programmatically loop through each blog and update that string. This works fine.
But the issue is scanning our custom theme.
Every time we add a new string in code, we have to manually go to each blog and rescan the theme. We now have 43 blogs and it becomes difficult to scan the theme 43 times for every new string added and is impractical
Is there a way we can have scan themes for all sites without having to go to each one individually?

September 27, 2018 at 6:23 pm #2771576

Diego Pereira
Supporter

Languages: English (English ) Spanish (Español ) Portuguese (Brazil) (Português )

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

Hello @bomannn, welcome to the WPML support Forum!

Unfortunately WPML does not currently have this option. One thing you can try is:
- Go to WPML > String Translation
- Scroll down to Auto register strings for translation and check if it's enabled for all text domains

if so, WPML will scan the theme/plugin when it's activated. This way you can check if disabling and re-enabling the theme on the network will register the string.

If this does not work, you will need custom code to build a function with this functionality. Here is the list of WPML hooks and filters available:
- https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference
- https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference/#hook-620585

We also have a list of experienced contractors available here: https://wpml.org/contractors/

Please let me know if it worked for you.

All the best,
Diego

September 28, 2018 at 11:26 am #2773525

bomannN

Your first solution seems it will get the job done. Will try it out.
But just out of curiosity, will deactivating WPML and re-activating it, scan strings network wide as well? Because i guess while updating the plugin it scans all strings network wide too.

September 28, 2018 at 6:39 pm #2774667

Diego Pereira
Supporter

Languages: English (English ) Spanish (Español ) Portuguese (Brazil) (Português )

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

Hi there,

I'm not sure, because after the scan, the strings are stored in the database. Apparently there is no need for a new scan if only WPML is disabled / enabled. But it's worth a try.

If you need more help just let me know.

Kind regards,
Diego