Last active
November 8, 2021 13:18
-
-
Save nielslange/f64a3f5fdd3102ef3c2ab78cc7d899c9 to your computer and use it in GitHub Desktop.
Translating strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { __ } from '@wordpress/i18n'; | |
__( 'Hello, Luigi!', 'woo-gutenberg-products-block' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { __, sprintf } from '@wordpress/i18n'; | |
const name = 'Luigi'; | |
sprintf( | |
__( 'Hello, %s!', 'woo-gutenberg-products-block' ), | |
name | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { _n, sprintf } from '@wordpress/i18n'; | |
const quantity = 5; | |
sprintf( | |
/* translators: %d number of products of the same type in the cart */ | |
_n( | |
'%d item', | |
'%d items', | |
quantity, | |
'woo-gutenberg-products-block' | |
), | |
quantity | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment