Pular para o conteúdo Pular para a barra lateral

Este tópico contém 0, tem 0 vozes.

Última atualização: oscarO-2 9 meses, 1 semana atrás.

Assistido por: Bruno Kos.

Autor Posts
maio 20, 2025 às 11:46 am #17052472

oscarO-2

Background of the issue:
I'm developing a custom plugin that allows users to add text to be displayed on the front end using wp_editor input. My site is in Dutch (default) and English. I'm trying to add different default values for a field in the plugin settings page depending on the language selected with the WPML admin language selector. The default value in Dutch is 'Dit is een standaard waarde' and in English it's 'This is a default value'. I've created a .po and .mo file for the plugin and am loading them through textdomain 'plugin_domain'. The value in PHP is: __( 'This is a default value', 'plugin_domain' ). In the frontend, the string is translated correctly, but in the backend (plugin settings page), I always get the default language (Dutch) even when switching to English with the admin bar language switcher. The options are not yet saved to the database. I get the same results using the string translation.

Symptoms:
In the backend plugin settings page, the default language (Dutch) is always displayed, even when switching to English with the admin bar language switcher.

Questions:
How can I show different default values for plugin settings depending on the selected language in the admin bar?