You appear to be a bot. Output may be restricted
Description
Switch to the required target language- WordPress core's switch_to_locale() function leaves much to be desired when the default language is en_US
- and/or when the translations are loaded from the plugin's language folders rather than WP_LANG_DIR
- We have to (re)load the language files ourselves.
Usage
Tests_libs_oik_plugins::switch_to_locale( $locale );
Parameters
- $locale
- ( mixed ) optional default: bb_BB –
Returns
voidTO DO
We also need to remember to pass the slug/domain to translate() 🙂 Note: For switch_to_locale() see https://core.trac.wordpress.org/ticket/26511 and https://core.trac.wordpress.org/ticket/39210Source
File name: oik-libs/tests/test-libs-oik_plugins.phpLines:
1 to 19 of 19
function switch_to_locale( $locale='bb_BB' ) { //$tdl = is_textdomain_loaded( "oik" ); //$this->assertTrue( $tdl ); $switched = switch_to_locale( $locale ); if ( $switched ) { $this->assertTrue( $switched ); } $new_locale = $this->query_la_CY(); $this->assertEquals( $locale, $new_locale ); $this->reload_domains(); $tdl = is_textdomain_loaded( "oik" ); $this->assertTrue( $tdl ); //$this->test_domains_loaded(); if ( $locale === 'bb_BB' ) { $bw = translate( "bobbingwide", "oik" ); $this->assertEquals( "bboibgniwde", $bw ); } }View on GitHub