Commit Graph

17 Commits (master)

Author SHA1 Message Date
Eric Chan 3db636481a Add YAML Support 2019-08-14 10:45:03 -07:00
fengmk2 47162d3230 feat: gettext from app (#38)
```js
app.__(locale, text, value);
```
2019-06-16 21:52:00 +08:00
Yiyu He 0767037b3c
feat: ctx.__setLocale (#36) 2019-04-30 20:11:00 +08:00
Yiyu He 3043365e09 feat: add __getLocaleOrigin (#35)
* chore: test on node 12
2019-04-29 16:15:14 +08:00
fengmk2 08037ee0ae
feat: allow custom locale store cookie domain (#33)
* test: use mocha@4
2019-04-17 10:43:00 +08:00
Tao Xu f89c6755c1 feat: add writeCookie option (#28) 2018-01-12 11:45:59 +08:00
Tao Xu dddb4c0c2e feat: support header lang from localeAlias (#27) 2017-04-27 16:04:15 +08:00
fengmk2 1f485fde83 fix: make sure signed=false on set/get cookie (#24) 2017-01-13 14:38:13 +08:00
ermin.zem ec48f1f20c feat: add localeAlias options 2016-03-16 20:10:34 +08:00
ermin.zem c45be8b6ea fix: return empty if the key-value is empty value
PR-URL: https://github.com/koajs/locales/pull/17
Reviewed-By: fengmk2 <fengmk2@gmail.com>
Reviewed-By: dead-horse <heyiyu.deadhorse@gmail.com>
2015-12-23 10:45:03 +08:00
fengmk2 629141717e fix: if header sent, don't set the cookie
bigpipe will fail
2015-12-09 18:23:54 +08:00
闲耘™ 36bd1d5202 refact(es6): use es6 syntax.
* fixed #10, But iojs-2 not support Object.assign, so use object-assign
  shim instead for now.
* use es6 syntax.
* use eslint to instead jshint.
2015-09-20 14:56:19 +08:00
Jason Lee 58324a11ff 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)
```
2015-09-17 18:20:10 +08:00
Jason Lee 5ffefcc982 feat: Multiple locale paths support. 2015-09-14 17:29:46 +08:00
popomore 757b28d170 feat: paramter support object 2015-07-15 22:25:23 +08:00
fengmk2 a2462e6a84 feat: support *.properties resource files 2015-05-17 21:54:12 +08:00
fengmk2 15864d180d first commit 2015-05-16 22:06:49 +08:00