Opened 6 years ago
Closed 6 years ago
#46230 closed defect (bug) (duplicate)
Calling `switch_to_locale()` fails to load plugin translations on subsequent calls
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | I18N | Keywords: | |
Focuses: | Cc: |
Description
In short, calling switch_to_locale()
followed by restore_previous_locale()
followed by switch_to_locale()
fails to reload plugin text-domain strings. It appears to work as expected with the default
text-domain however.
An example in code (see unit test attached).
$english_text_expected = __( 'Testing', 'textdomain' ); // returns 'Testing' switch_to_locale( 'de_DE' ); $german_expected = __( 'Testing', 'textdomain' ); // returns 'Testen' restore_previous_locale(); // Reset to English. switch_to_locale( 'de_DE' ); $german_expected_again = __( 'Testing', 'textdomain' ); // returns 'Testing' - No translation? restore_previous_locale();
Attachments (1)
Change History (2)
Note: See
TracTickets for help on using
tickets.
Duplicate of #39210.