Changeset 55865
- Timestamp:
- 05/29/2023 08:34:43 AM (20 months ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-textdomain-registry.php
r55349 r55865 98 98 public function has( $domain ) { 99 99 return ( 100 ! empty( $this->current[ $domain ] ) ||100 isset( $this->current[ $domain ] ) || 101 101 empty( $this->all[ $domain ] ) || 102 102 in_array( $domain, $this->domains_with_translations, true ) -
trunk/src/wp-includes/l10n.php
r55862 r55865 835 835 836 836 if ( isset( $l10n[ $domain ] ) ) { 837 if ( $l10n[ $domain ] instanceof NOOP_Translations ) { 838 unset( $l10n[ $domain ] ); 839 840 return false; 841 } 842 837 843 unset( $l10n[ $domain ] ); 838 844 … … 1308 1314 } 1309 1315 1316 $l10n[ $domain ] = &$noop_translations; 1317 1310 1318 return $noop_translations; 1311 1319 } … … 1323 1331 function is_textdomain_loaded( $domain ) { 1324 1332 global $l10n; 1325 return isset( $l10n[ $domain ] ) ;1333 return isset( $l10n[ $domain ] ) && ! $l10n[ $domain ] instanceof NOOP_Translations; 1326 1334 } 1327 1335 -
trunk/tests/phpunit/tests/l10n/loadTextdomainJustInTime.php
r54669 r55865 123 123 124 124 /** 125 * @ticket 58321 126 * 127 * @covers ::get_translations_for_domain 128 */ 129 public function test_get_translations_for_domain_get_locale_is_called_only_once() { 130 $filter_locale = new MockAction(); 131 add_filter( 'locale', array( $filter_locale, 'filter' ) ); 132 133 get_translations_for_domain( 'internationalized-plugin' ); 134 get_translations_for_domain( 'internationalized-plugin' ); 135 get_translations_for_domain( 'internationalized-plugin' ); 136 $translations = get_translations_for_domain( 'internationalized-plugin' ); 137 138 remove_filter( 'locale', array( $filter_locale, 'filter' ) ); 139 140 $this->assertSame( 1, $filter_locale->get_call_count() ); 141 $this->assertInstanceOf( 'NOOP_Translations', $translations ); 142 $this->assertFalse( is_textdomain_loaded( 'internationalized-plugin' ) ); 143 } 144 145 /** 125 146 * @ticket 37113 126 147 * -
trunk/tests/phpunit/tests/l10n/wpLocaleSwitcher.php
r55224 r55865 385 385 $locale_switched_site_locale = switch_to_locale( $site_locale ); // True. 386 386 $site_locale_after_switch = get_locale(); 387 $language_header_after_switch = is set( $l10n['default']); // en_US387 $language_header_after_switch = is_textdomain_loaded( 'default' ); // en_US 388 388 389 389 restore_current_locale();
Note: See TracChangeset
for help on using the changeset viewer.