translate_settings_using_i18n_schema( string|string[]|array[]|object $i18n_schema, string|string[]|array[] $settings, string $textdomain ): string|string[]|array[]

In this article

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

Translates the provided settings value using its i18n schema.

Parameters

$i18n_schemastring|string[]|array[]|objectrequired
I18n schema for the setting.
$settingsstring|string[]|array[]required
Value for the settings.
$textdomainstringrequired
Textdomain to use with translations.

Return

string|string[]|array[] Translated settings.

Source

		$translated_settings = array();
		foreach ( $settings as $key => $value ) {
			if ( isset( $i18n_schema->$key ) ) {
				$translated_settings[ $key ] = translate_settings_using_i18n_schema( $i18n_schema->$key, $value, $textdomain );
			} elseif ( isset( $i18n_schema->$group_key ) ) {
				$translated_settings[ $key ] = translate_settings_using_i18n_schema( $i18n_schema->$group_key, $value, $textdomain );
			} else {
				$translated_settings[ $key ] = $value;
			}
		}
		return $translated_settings;
	}
	return $settings;
}

/**
 * Retrieves the list item separator based on the locale.
 *
 * @since 6.0.0
 *
 * @global WP_Locale $wp_locale WordPress date and time locale object.
 *
 * @return string Locale-specific list item separator.
 */
function wp_get_list_item_separator() {
	global $wp_locale;

	if ( ! ( $wp_locale instanceof WP_Locale ) ) {
		// Default value of WP_Locale::get_list_item_separator().
		/* translators: Used between list items, there is a space after the comma. */
		return __( ', ' );

Changelog

VersionDescription
5.9.0Introduced.

User Contributed Notes

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