Saltar navegación

Este hilo está resuelto. Aquí tienes una descripción del problema y la solución.

Problem:
The client needed to edit the .pot file of a specific plugin to add more strings and then synchronize the .po file in Spanish to translate the new strings.
Solution:
We explained that WPML handles plugin texts differently than editing PO/POT files directly. We use the gettext function to register strings for translation within the WPML > String Translation screen. To work with translatable strings, the client should register them using

_e('text', 'domain-name')

when echoing content or

__('text', 'domain-name')

when working with strings but not echoing them. WPML can then register the string if the client scans their theme and/or plugin. We provided links to documentation that details the process:

If this solution is not relevant due to being outdated or not applicable to your case, we recommend opening a new support ticket. We also highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins.

If you need further assistance, please contact our support forum.

Este es el foro de soporte técnico de WPML, el plugin multilingüe de WordPress.

Todas las personas pueden leerlo pero solo los clientes de WPML pueden ingresar comentarios. El equipo de WPML responde en los foros 6 días a la semana, 22 horas por día.

Etiquetado: 

Este tema contiene 1 respuesta, tiene 2 voces.

Última actualización por Mateus Getulio hace 1 año, 1 mes.

Asistido por: Mateus Getulio.

Autor Entradas
marzo 19, 2024 en 8:42 am #15424601

sembi-comunicaciOnS

Hello,

I need to edit the .pot file of a specific plugin to add more strings and then synchronize the .po file in Spanish to get the new strings and translate them (similar to what Loco Translate does).

Is this possible with WPML ?

Thanks

marzo 19, 2024 en 4:21 pm #15427555

Mateus Getulio
Colaborador

Idiomas: Inglés (English ) Portugués, Brasil (Português )

Zona horaria: America/Sao_Paulo (GMT-03:00)

Hello there,

The way WPML works with texts coming from plugins is different than the process you described of editing the PO/POT files directly.

We use the gettext function(enlace oculto) to register those strings and allow you to translate them within the WPML > String Translation screen.

The process has been broken down and detailed in those articles:

https://wpml.org/documentation/support/enabling-text-translation-for-themes-not-compatible-with-wpml/

https://wpml.org/documentation/support/translation-for-texts-by-other-plugins-and-themes/

In essence, when working with translatable strings, you need to register then by using either _e('text', 'domain-name') > (when you're echoing out content) or __('text', 'domain-name') > (when you're working with strings but not echoing them in that part of the code).

By using this approach, you assure that WPML will be able to register the string if you scan your theme and/or plugin:
https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/#scan-the-theme-or-plugin
https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/#enable-auto-register-strings

Please check this material and see if it helps.

Thank you, please let us know.
Mateus