Gettext_Translations::make_plural_form_function()

最后更新于:2021-11-25 19:52:05

Gettext_Translations::make_plural_form_function( int$nplurals, string$expression)

Makes a function, which will return the right translation index, according to the plural forms header

参数

$nplurals

(int) (Required)

$expression

(string) (Required)

源文件

文件: gc-includes/pomo/translations.php

		function make_plural_form_function( $nplurals, $expression ) {
			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( 2, 'n != 1' );
			}
		}