feat: Support nested locale keys.
Example:
```js
{
model: {
user: {
name: 'Real Name',
createdAt: 'Joined At'
}
}
}
```
```js
ctx.__('model.user.name');
ctx.__('model.user.createdAt');
```
The before:
```js
{
'model.user.name': 'Real Name',
'model.user.createdAt', 'Joined At'
}
```
Benchmarks:
```
Deeps: 9
2 tests completed.
direct read a key x 85,993,593 ops/sec ±1.89% (96 runs sampled)
by nested x 4,203,837 ops/sec ±0.98% (93 runs sampled)
```
This commit is contained in:
@@ -1,4 +1,12 @@
|
||||
module.exports = {
|
||||
Email: '邮箱',
|
||||
'Hello %s, how are you today?': '%s,今天过得如何?',
|
||||
model: {
|
||||
user: {
|
||||
fields: {
|
||||
name: '姓名',
|
||||
gender: '性别'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
{
|
||||
"Email": "郵箱",
|
||||
"Hello %s, how are you today?": "%s,今天過得如何?"
|
||||
"Hello %s, how are you today?": "%s,今天過得如何?",
|
||||
"model": {
|
||||
"user": {
|
||||
"fields": {
|
||||
"name": "姓名",
|
||||
"gender": "性別"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user