make_plural_form_function example


        public function gettext_select_plural_form( $count ) {
            if ( ! isset( $this->_gettext_select_plural_form ) || is_null( $this->_gettext_select_plural_form ) ) {
                list( $nplurals$expression )     = $this->nplurals_and_expression_from_header( $this->get_header( 'Plural-Forms' ) );
                $this->_nplurals                   = $nplurals;
                $this->_gettext_select_plural_form = $this->make_plural_form_function( $nplurals$expression );
            }
            return call_user_func( $this->_gettext_select_plural_form, $count );
        }

        /** * @param string $header * @return array */
        public function nplurals_and_expression_from_header( $header ) {
            if ( preg_match( '/^\s*nplurals\s*=\s*(\d+)\s*;\s+plural\s*=\s*(.+)$/', $header$matches ) ) {
                $nplurals   = (int) $matches[1];
                
Home | Imprint | This part of the site doesn't use cookies.