21.9.0 • Published 3 years ago
@litejs/i18n v21.9.0
@litejs/i18n –
Translation, pluralization, date and number formating.
i18n.def({"en": "In English"})
i18n.add("en", {
// Numbers extension namespace
"#": {
".05": "# ###.05", // Number rounded to .05
"gas": "#/8", // Fractions
"money": " $# ###,05 ;n\a;($# ###,05);zero"
},
// Pluralization extension namespace
"*": {
"message": "one message;# messages"
},
// Selection extension namespace
"?": {
"friend": "friend;male=boyfriend;female=girlfriend"
},
// Date and time extension namespace
"@": {
"LT": "h:mm a", // Local Time
"LD": "MM/DD/y" // Local Date
},
"welcome": "Hello, {user.name}!",
"inbox": "You have {count;*message} from your {friend.sex;?friend}!"
})
var data = { user: {name: "Bob"}, count: 15, friend: { sex: "female" } })
i18n("welcome", data)
// Hello, Bob!
i18n("inbox", data)
// You have 15 messages from your girlfriend!
See wiki for more.
Licence
Copyright (c) 2021 Lauri Rooden <lauri@rooden.ee>
The MIT License |
Source code
21.9.0
3 years ago
20.0.0-rc.15
4 years ago
20.0.0-rc.14
4 years ago
20.0.0-rc.13
4 years ago
20.0.0-rc.12
4 years ago
20.0.0-rc.11
4 years ago
20.0.0-rc.10
4 years ago
20.0.0-rc.9
4 years ago
20.0.0-rc.8
4 years ago
20.0.0-rc.7
4 years ago
20.0.0-rc.6
4 years ago
20.0.0-rc.5
4 years ago
20.0.0-rc.4
4 years ago
20.0.0-rc.3
4 years ago
20.0.0-rc.2
4 years ago
20.0.0-rc.1
4 years ago