Is there a way to change the language in WordPress like Something like this Is it possible in WordPress normally? So I finally got the solution to the function It is said to be on my side how to define It took some time to find this method in the core. Read more about that function switch_to_blog ()
global $ locale $ currentLanguage = $ locale; Switch_to_language ('de_DE'); // Take some action with german localization switch_to_language ($ currentLanguage);
load_textdomain ()
LANGUAGE_PATH and the language you want to switch to
$ new_language
$ your_domain is the text domain of your plugin / theme
// Output "Good Morning" _e ('Good Morning', $ your_domain); Global $ locale; // Save the current $ current_language = $ locale for the current language; $ New_language = 'DE_de'; // Load new text domain load_testdomain ($ your_language_domain, LANGUAGE_PATH. '/'. $ Your_domain. '-'. $ New_language. 'Mo'); // Take some action with new localization / Output "Guten Morgan" _e ('Good Morning', $ your_domain); // Back to previous language load_textdomain ($ your_language_domain, LANGUAGE_PATH. '/'. $ Your_domain. '-'. $ Current_language. '.' Mo ');
No comments:
Post a Comment