Pular a navegação

Este é o fórum de suporte técnico para o WPML — o plugin de WordPress multilíngue.

Todos podem ler, mas apenas clientes do WPML podem postar aqui. A equipe do WPML responde no fórum 6 dias por semana, 22 horas por dia.

Nenhum atendente de suporte está disponível para trabalhar hoje no fórum Portuguese. Fique à vontade para abrir tickets e iremos tratar deles assim que estivermos online. Obrigado pela compreensão.

Sun Mon Tue Wed Thu Fri Sat
- - 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00
- - - - - - -

Fuso horário do apoiador: America/Lima (GMT-05:00)

Este tópico contém 12 respostas, tem 2 vozes.

Última atualização: Andreas W. 11 mes, 4 semanas atrás.

Assistido por: Andreas W..

Autor Posts
Abril 16, 2023 em 10:02 am #13481309

a.N

Hi,

I have 4 languages on the site:

Portuguese (main language), English, French and Russian

I have a string on a shortcode that appears when I run a scan on that specific text domain. When I translate that (they all are translated), it only show's that translation on one language (English). On Russian and French, wit shows the Portuguese (on the shortcode)...

Already tried this without success:

https://wpml.org/pt-br/faq/why-arent-my-translated-strings-showing-up-on-the-front-end-of-my-site/

https://wpml.org/forums/topic/translations-are-not-showing-in-the-front-end/

Here's my shortcode:

function cofinanciamento_shortcode( $content = null ) {
$funding_text = _x( 'Funding Source:', 'Cofinacement translation', 'lwpt');
$content .= '<p style="text-align:center;"><span style="font-size:small;font-weight:200;">' . $funding_text . '</span><br>';
$content .= '<img src="'.get_stylesheet_directory_uri().'https://cdn.wpml.org/images/funding.webp" alt="' . $funding_text . '" width="100%" height="auto" loading="lazy"/></p>';
return $content;
}

Abril 18, 2023 em 8:39 am #13493901

a.N

Someone, please?

Abril 20, 2023 em 12:29 am #13508301

Andreas W.
Supporter

Idiomas: Inglês (English ) Alemão (Deutsch )

Fuso horário: America/Lima (GMT-05:00)

Hello,

Now, it is very odd that this works on one language and on others not, but the way you register the strings for translation is kind of uncommon.

It looks to me as if you register various strings with the same GetText Call which might be the cause of the issue.

Usually, you use one GetText call for each string and this call needs to have a text-domain as the second argument.

Example:
__('string', 'text-domain');

Without text-domain, it will not work, and possibly more than one string per GetText Function might not work either. Please give this a try.

Complete guide:
https://wpml.org/documentation/support/translating-the-theme-you-created/

Best regards
Andreas

maio 2, 2023 em 3:36 pm #13572197

a.N

Hi,

I tested your example and the issue still remains.

But if I turn on the option "Search for strings while pages are generated", the translations works fine while it's active...

maio 2, 2023 em 8:02 pm #13573939

Andreas W.
Supporter

Idiomas: Inglês (English ) Alemão (Deutsch )

Fuso horário: America/Lima (GMT-05:00)

Hello,

Please add the following code to your wp-config.php:

define( 'WPML_ST_SYNC_TRANSLATION_FILES', true );

Does this solve the issue?

Source:
https://wpml.org/documentation/support/wpml-coding-api/wpml-constants/#wpml_st_sync_translation_files

Best regards
Andreas

maio 2, 2023 em 9:40 pm #13574221

a.N

Hi,

No. I have this on the hook "generate_after_footer_content". Can this be related?

maio 2, 2023 em 9:55 pm #13574257

Andreas W.
Supporter

Idiomas: Inglês (English ) Alemão (Deutsch )

Fuso horário: America/Lima (GMT-05:00)

Hello,

Yes, this could be - maybe you should try to hook in earlier - did you test by hooking into the_content?

I can offer a WPML Test Site on which we can try to recreate this and work on a solution if you wish.

Let me know, and I will send you a link to a test site on which you can install your theme/plugin.

Best regards
Andreas

maio 2, 2023 em 9:58 pm #13574259

Andreas W.
Supporter

Idiomas: Inglês (English ) Alemão (Deutsch )

Fuso horário: America/Lima (GMT-05:00)

Hello,

Did you try with ob_start() and ob_get_clean() as suggested here?

link oculto

Best regards
Andreas

maio 3, 2023 em 11:19 am #13577953

a.N

Hi,

It works on the hook "generate_before_main_content" but I need it on "generate_after_footer_content"...

It doesn't work on "generate_after_footer_content"...

So, I guess that the problem may be in there as I have other shortcodes that are translated inside the_content

I also tried before with ob_start() and ob_get_clean() as suggested (doesn't work either).

maio 3, 2023 em 4:26 pm #13580891

a.N

Please do't forget to read the above and: how can I send debug info (privately)?

maio 3, 2023 em 6:30 pm #13581593

Andreas W.
Supporter

Idiomas: Inglês (English ) Alemão (Deutsch )

Fuso horário: America/Lima (GMT-05:00)

Hello,

Thank you very much.

I have created a test site with WPML and GeneratePress.

You will find a File Manager Plugin in order to access the server.

Could you please recreate the issue here so that we can look into it and work on a solution?

One-Click-Login:
link oculto

Please leave me a short comment on this ticket, once the issue was recreated.

Best regards
Andreas

maio 3, 2023 em 9:31 pm #13582157

a.N

Maybe you could see the debug info (privately), first..?

maio 4, 2023 em 1:42 am #13582435

Andreas W.
Supporter

Idiomas: Inglês (English ) Alemão (Deutsch )

Fuso horário: America/Lima (GMT-05:00)

Hello,

I've enabled a private message for submitting the debug information for this support ticket. Please see this link for how to get this information from your site and give it to us:
http://wpml.org/faq/provide-debug-information-faster-support/

Make sure to only use the private reply form in order to provide this information. Please do not paste the debug information directly into a comment on this ticket.

Best regards
Andreas

O tópico '[Fechado] Some string translations not showing on the frontend' está fechado para novas respostas.