mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Partially revert docs commit 7710cf59
i18n.js doesn't support named parameters (yet)
This commit is contained in:
parent
2b6d735182
commit
64888c07b7
@ -299,13 +299,14 @@ Example Translation Table (mymodule/javascript/lang/de_DE.js)
|
|||||||
alert(ss.i18n._t('MYMODULE.MYENTITY'));
|
alert(ss.i18n._t('MYMODULE.MYENTITY'));
|
||||||
|
|
||||||
|
|
||||||
### Advanced Usage with injection
|
### Advanced Usage with sprintf()
|
||||||
|
|
||||||
:::js
|
:::js
|
||||||
// MYMODULE.MYENTITY contains "Really delete {answer} articles by {author} authors?"
|
// MYMODULE.MYENTITY contains "Really delete %s articles by %s authors?"
|
||||||
alert(ss.i18n._t('MYMODULE.MYENTITY'),
|
alert(ss.i18n.sprintf(
|
||||||
array('answer' => 42, 'author' => 'Douglas Adams')
|
ss.i18n._t('MYMODULE.MYENTITY'),
|
||||||
));
|
42,
|
||||||
|
'Douglas Adams'
|
||||||
// Displays: "Really delete 42 articles by Douglas Adams?"
|
// Displays: "Really delete 42 articles by Douglas Adams?"
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user