New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

egg-i18n

Package Overview
Dependencies
Maintainers
5
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

egg-i18n - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

2

app.js

@@ -55,3 +55,3 @@ 'use strict';

*/
module.exports = function(app) {
module.exports = app => {
/**

@@ -58,0 +58,0 @@ * 如果开启了 I18n 多语言功能,那么会出现此 API,通过它可以获取到当前请求对应的本地化数据。

'use strict';
const LOCALE = Symbol('context#locale');
module.exports = {

@@ -10,4 +12,9 @@ /**

get locale() {
return this.__getLocale();
if (this[LOCALE] === undefined) return this.__getLocale();
return this[LOCALE];
},
set locale(l) {
this[LOCALE] = l;
},
};

@@ -16,2 +16,3 @@ 'use strict';

* 默认是存储在key 为 locale 的 cookie 中
* @property {String} cookieDomain - 存储 locale 的 cookie domain 配置,默认不设置,为当前域名才有效
* @property {String|Number} cookieMaxAge - cookie 默认 `1y` 一年后过期,

@@ -25,2 +26,3 @@ * 如果设置为 Number,则单位为 ms

cookieField: 'locale',
cookieDomain: '',
cookieMaxAge: '1y',

@@ -27,0 +29,0 @@ };

2.1.0 / 2019-04-28
==================
**features**
* [[`ce59330`](http://github.com/eggjs/egg-i18n/commit/ce59330ef1dc069f43ebde29f8fe345f6a4d186e)] - feat: support ctx.locale setter (#10) (Yiyu He <<dead_horse@qq.com>>)
**others**
* [[`50322d6`](http://github.com/eggjs/egg-i18n/commit/50322d680e783b30cfed7ffb39e36d3edf2ed210)] - chore: add cookieDomain options description (#9) (fengmk2 <<fengmk2@gmail.com>>)
2.0.0 / 2017-11-10

@@ -3,0 +12,0 @@ ==================

{
"name": "egg-i18n",
"version": "2.0.0",
"version": "2.1.0",
"eggPlugin": {

@@ -39,11 +39,11 @@ "name": "i18n"

"ci": {
"version": "8, 9"
"version": "8, 10, 11"
},
"dependencies": {
"debug": "^3.1.0",
"koa-locales": "^1.7.0"
"koa-locales": "^1.9.0"
},
"devDependencies": {
"autod": "^2.10.1",
"egg": "next",
"egg": "^2.21.1",
"egg-bin": "^4.3.5",

@@ -50,0 +50,0 @@ "egg-ci": "^1.8.0",

@@ -27,4 +27,4 @@ # egg-i18n

- 支持多种语言独立配置,统一存放在 config/locale/*.js 下( 兼容`config/locales/*.js` );
- 提供 Middleware 为 View 提供 `__`, `gettext` 函数获取多语言文案;
- 支持多种语言独立配置,统一存放在 config/locale/\*.js 下( 兼容 `config/locales/*.js` );
- 提供 Middleware 为 View 提供 `\_\_`, `gettext` 函数获取多语言文案;
- 基于 URL 参数 `locale` 修改语言显示,同时会记录到 Cookie,下次请求会用 Cookie 里面的语言方案。

@@ -55,2 +55,4 @@

cookieField: 'locale',
// Cookie 的 domain 配置,默认为空,代表当前域名有效
cookieDomain: '',
// Cookie 默认 `1y` 一年后过期, 如果设置为 Number,则单位为 ms

@@ -141,2 +143,2 @@ cookieMaxAge: '1y',

- cookie: locale=zh-TW
- header: Accept-Language: zh-CN,zh;q=0.5
- header: Accept-Language: zh-CN,zh;q=0.5
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc