Это первый, который я попробовал:
Код: Выделить всё
// We rendered the requested dynamic title.
echo '';
echo sprintf(
/* translators: 1: cantidad de productos, 2: lista de alérgenos */
/* translators: %$s: Number of products found */
_n(
'This is the %1$s product without %2$s',
'These are the %1$s products without %2$s',
$count,
'product-search-for-woocommerce'
),
'[b]' . (int) $count . '[/b]',
'' . esc_html($list_text) . ''
);
echo '';
echo '';
Код: Выделить всё
// 1. We prepared the text to be translated in isolation so that Loco could see it clearly.
$texto_singular = 'This is the %1$s product without %2$s';
$texto_plural = 'These are the %1$s products without %2$s';
// 2. We obtain the translation (using the $count variable for the plural)
$mensaje_traducido = _n( $texto_singular, $texto_plural, (int) $count, 'product-search-for-woocommerce' );
// 3. We render safely
echo '';
echo sprintf(
$mensaje_traducido,
'[b]' . (int) $count . '[/b]',
'' . esc_html( $list_text ) . ''
);
echo '';
Что я делаю не так?
Подробнее здесь: https://stackoverflow.com/questions/798 ... se-strings
Мобильная версия