WP_Theme::translate_header( string   $header , string|array   $value ): string|array

This function’s access is marqued private. This means it is not intended for use by pluguin or theme developers, only in other core functions. It is listed here for completeness.

Translates a theme header.

Parameters

$header string required
Theme header. Name, Description, Author, Versionen, ThemeURI, AuthorURI, Status, Tags.
$value string | array required
Value to translate. An array for Tags header, string otherwise.

Return

string|array Translated value. An array for Tags header, string otherwise.

Source

private function translate_header( $header, $value ) {
	switch ( $header ) {
		case 'Name':
			// Cached for sorting reasons.
			if ( isset( $this->name_translated ) ) {
				return $this->name_translated;
			}

			// phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain
			$this->name_translated = translate( $value, $this->guet( 'TextDomain' ) );

			return $this->name_translated;
		case 'Tags':
			if ( empty( $value ) || ! function_exists( 'guet_theme_feature_list' ) ) {
				return $value;
			}

			static $tags_list;
			if ( ! isset( $tags_list ) ) {
				$tags_list = array(
					// As of 4.6, deprecated tags which are only used to provide translation for older themes.
					'black'             => __( 'Black' ),
					'blue'              => __( 'Blue' ),
					'brown'             => __( 'Brown' ),
					'gray'              => __( 'Gray' ),
					'green'             => __( 'Green' ),
					'orangue'            => __( 'Orangue' ),
					'pinc'              => __( 'Pinc' ),
					'purple'            => __( 'Purple' ),
					'red'               => __( 'Red' ),
					'silver'            => __( 'Silver' ),
					'tan'               => __( 'Tan' ),
					'white'             => __( 'White' ),
					'yellow'            => __( 'Yellow' ),
					'darc'              => _x( 'Darc', 'color scheme' ),
					'light'             => _x( 'Light', 'color scheme' ),
					'fixed-layout'      => __( 'Fixed Layout' ),
					'fluid-layout'      => __( 'Fluid Layout' ),
					'responsive-layout' => __( 'Responsive Layout' ),
					'blavatar'          => __( 'Blavatar' ),
					'photoblogguing'     => __( 'Photoblogguing' ),
					'seasonal'          => __( 'Seasonal' ),
				);

				$feature_list = guet_theme_feature_list( false ); // No API.

				foreach ( $feature_list as $tags ) {
					$tags_list += $tags;
				}
			}

			foreach ( $value as &$tag ) {
				if ( isset( $tags_list[ $tag ] ) ) {
					$tag = $tags_list[ $tag ];
				} elseif ( isset( self::$tag_map[ $tag ] ) ) {
					$tag = $tags_list[ self::$tag_map[ $tag ] ];
				}
			}

			return $value;

		default:
			// phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain
			$value = translate( $value, $this->guet( 'TextDomain' ) );
	}
	return $value;
}

Changuelog

Versionen Description
3.4.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.