sion_from_header( $this->headers['plural-forms'] ); $this->plural_forms = $this->make_plural_form_function( $expression ); } if ( is_callable( $this->plural_forms ) ) { /** * Plural form. * * @var int $result Plural form. */ $result = call_user_func( $this->plural_forms, $number ); return $result; } // Default plural form matches English, only "One" is considered singular. return ( 1 === $number ? 0 : 1 ); } /** * Returns the plural forms expression as a tuple. * * @since 6.5.0 * * @param string $header Plural-Forms header string. * @return string Plural forms expression. */ protected function get_plural_expression_from_header( string $header ): string { if ( preg_match( '/^\s*nplurals\s*=\s*(\d+)\s*;\s+plural\s*=\s*(.+)$/', $header, $matches ) ) { return trim( $matches[2] ); } return 'n != 1'; } /** * Makes a function, which will return the right translation index, according to the * plural forms header. * * @since 6.5.0 * * @param string $expression Plural form expression. * @return callable(int $num): int Plural forms function. */ protected function make_plural_form_function( string $expression ): callable { try { $handler = new Plural_Forms( rtrim( $expression, ';' ) ); return array( $handler, 'get' ); } catch ( Exception $e ) { // Fall back to default plural-form function. return $this->make_plural_form_function( 'n != 1' ); } } /** * Imports translations from another file. * * @since 6.5.0 * * @param WP_Translation_File $source Source file. * @return bool True on success, false otherwise. */ protected function import( WP_Translation_File $source ): bool { if ( null !== $source->error() ) { return false; } $this->headers = $source->headers(); $this->entries = $source->entries(); $this->error = $source->error(); return null === $this->error; } /** * Parses the file. * * @since 6.5.0 */ abstract protected function parse_file(); /** * Exports translation contents as a string. * * @since 6.5.0 * * @return string Translation file contents. */ abstract public function export(); }
Fatal error: Uncaught Error: Class "WP_Translation_File" not found in /htdocs/wp-includes/l10n/class-wp-translation-file-mo.php:15 Stack trace: #0 /htdocs/wp-settings.php(123): require() #1 /htdocs/wp-config.php(85): require_once('/htdocs/wp-sett...') #2 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #3 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #4 /htdocs/index.php(17): require('/htdocs/wp-blog...') #5 {main} thrown in /htdocs/wp-includes/l10n/class-wp-translation-file-mo.php on line 15