Gettext plural strings
-
Hi.
I am trying to translate this piece of string in a gettext function filter.add_filter( 'gettext', function( $translation, $text, $domain ) { if ( $domain == 'wp-menu-cart' ) { if ( $text == '%d item' ) { $translation = '%d tilmeldt'; } if ( $text == '%d items' ) { $translation = '%d tilmeldte'; } } return $translation; }, 10, 3 );
That does not work. Is there something I have to be aware of, when trying to translate singular/plural strings?
The string that I am trying to translate is in this line:
sprintf(_n('%d item', '%d items', $item_data['cart_contents_count'], 'wp-menu-cart'), $item_data['cart_contents_count']);
I don’t want to translate the .po file, because this is overwritten on updates.
I hope you can help. ??The page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Gettext plural strings’ is closed to new replies.