Automattic\WooCommerce\Utilities

I18nUtil::get_dimensions_unit_label()public staticWC 1.0

Get the translated label for a dimensions unit of measure.

This will return the original input string if it isn't found in the units array. This way a custom unit of measure can be used even if it's not getting translated.

Метод класса: I18nUtil{}

Хуков нет.

Возвращает

Строку.

Использование

$result = I18nUtil::get_dimensions_unit_label( $dimensions_unit );
$dimensions_unit(строка) (обязательный)
The abbreviated dimension unit in English, e.g. cm.

Код I18nUtil::get_dimensions_unit_label() WC 9.3.3

public static function get_dimensions_unit_label( $dimensions_unit ) {
	if ( empty( self::$units ) ) {
		self::$units = include WC()->plugin_path() . '/i18n/units.php';
	}

	$label = $dimensions_unit;

	if ( ! empty( self::$units['dimensions'][ $dimensions_unit ] ) ) {
		$label = self::$units['dimensions'][ $dimensions_unit ];
	}

	return $label;
}