translate_with_gettext_context example

array( 'yes', 'true' ),
                                true
                            );
                        } else {
                            unset( $pattern_data[ $property ] );
                        }
                    }

                    // Translate the pattern metadata.                     $text_domain = $theme->get( 'TextDomain' );
                    //phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText, WordPress.WP.I18n.NonSingularStringLiteralContext, WordPress.WP.I18n.NonSingularStringLiteralDomain, WordPress.WP.I18n.LowLevelTranslationFunction                     $pattern_data['title'] = translate_with_gettext_context( $pattern_data['title'], 'Pattern title', $text_domain );
                    if ( ! empty( $pattern_data['description'] ) ) {
                        //phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText, WordPress.WP.I18n.NonSingularStringLiteralContext, WordPress.WP.I18n.NonSingularStringLiteralDomain, WordPress.WP.I18n.LowLevelTranslationFunction                         $pattern_data['description'] = translate_with_gettext_context( $pattern_data['description'], 'Pattern description', $text_domain );
                    }

                    // The actual pattern content is the output of the file.                     ob_start();
                    include $file;
                    $pattern_data['content'] = ob_get_clean();
                    if ( ! $pattern_data['content'] ) {
                        continue;
                    }

function _x( $text$context$domain = 'default' ) {
    return translate_with_gettext_context( $text$context$domain );
}

/** * Displays translated string with gettext context. * * @since 3.0.0 * * @param string $text Text to translate. * @param string $context Context information for the translators. * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. * Default 'default'. */
Home | Imprint | This part of the site doesn't use cookies.