[Resuelto] WPML is not reading the translations from my .mo files.
Este hilo está resuelto. Aquí tienes una descripción del problema y la solución.
Problem: The client is experiencing issues with translations not loading correctly in a theme using
load_textdomain
with WPML. The issue was identified with the ru_RU.mo file not loading translations properly. Solution: We recommend the following steps to resolve the issue: 1. Delete the ru_RU.mo file from your theme. 2. Regenerate the .mo file from the corresponding .po file. 3. Upload the new .mo file to your theme. After completing these steps, the translations should display correctly.
Please note that this solution might be outdated or not applicable to your specific case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the issue persists, please open a new support ticket at WPML 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.
Hi, I have a theme where all translations are loaded using load_textdomain, but it is not working with WPML. It’s my understanding that when I switch to a specific language, WPML should automatically read the translation strings from my theme's files, right? Am I missing something?
Como te decia, solo funciona en ingles (porque es el idioma por defecto de los ficheros): enlace oculto
y en español (es el idioma en el que está configurado WordPress): enlace oculto
Si pruebas cualquier otro idioma, verás que sale en inglés pese a tener todos los .mo y .po en el theme:
Ruso: enlace oculto
Italiano: enlace oculto
Francés: enlace oculto
El problema no está relacionado con WPML, sino con el archivo ru_RU.mo, que no estaba cargando correctamente las traducciones con contexto.
He realizado una prueba en local, sin WPML, configurando WordPress en ruso. Al eliminar el archivo ru_RU.mo y regenerarlo a partir del .po, las traducciones comenzaron a mostrarse correctamente.
Por lo tanto, te recomiendo hacer lo mismo en tu sitio:
- eliminar el archivo ru_RU.mo
- regenerarlo a partir del archivo .po
- subir el nuevo .mo
Después de esto, las traducciones deberían mostrarse correctamente.