Why doesn’t Loco recognize these strings?

1 week ago 10
ARTICLE AD BOX

I have dynamic text that Loco Translate isn't recognizing.I added the text myself to a plugin file I downloaded from the WordPress repository.I ran several different tests; I'll only include two here to keep it brief.

This is the first one I tried:

// We rendered the requested dynamic title. echo '<h2 class="product-results-page-title" style="margin-bottom: 30px; text-align: left;">'; 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' ), '<strong>' . (int) $count . '</strong>', '<span class="product-search-name">' . esc_html($list_text) . '</span>' ); echo '</h2>'; echo '</h2>';

It doesn't recognize this one

// 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 '<h2 class="product-results-page-title" style="margin-bottom: 30px; text-align: left;">'; echo sprintf( $mensaje_traducido, '<strong>' . (int) $count . '</strong>', '<span class="product-search-name">' . esc_html( $list_text ) . '</span>' ); echo '</h2>';

It doesn't recognize this one either.

What am I doing wrong?

Read Entire Article