Socket
Socket
Sign inDemoInstall

vue-i18n

Package Overview
Dependencies
Maintainers
1
Versions
352
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-i18n - npm Package Compare versions

Comparing version 2.4.0 to 2.4.1

9

CHANGELOG.md

@@ -0,1 +1,10 @@

<a name="2.4.1"></a>
## [2.4.1](https://github.com/kazupon/vue-i18n/compare/v2.4.0...v2.4.1) (2016-02-29)
### Features
* **i18n:** support ruby on rails i18n interpolation format ([b6b2490](https://github.com/kazupon/vue-i18n/commit/b6b2490))
<a name="2.4.0"></a>

@@ -2,0 +11,0 @@ # [2.4.0](https://github.com/kazupon/vue-i18n/compare/v2.3.3...v2.4.0) (2016-02-06)

8

dist/vue-i18n.common.js
/*!
* vue-i18n v2.4.0
* vue-i18n v2.4.1
* (c) 2016 kazuya kawaguchi

@@ -21,3 +21,3 @@ * Released under the MIT License.

var RE_NARGS = /\{([0-9a-zA-Z]+)\}/g;
var RE_NARGS = /(%|)\{([0-9a-zA-Z]+)\}/g;

@@ -45,3 +45,3 @@ /**

return string.replace(RE_NARGS, function (match, i, index) {
return string.replace(RE_NARGS, function (match, prefix, i, index) {
var result = undefined;

@@ -235,4 +235,4 @@

plugin.version = '2.4.0';
plugin.version = '2.4.1';
module.exports = plugin;
/*!
* vue-i18n v2.4.0
* vue-i18n v2.4.1
* (c) 2016 kazuya kawaguchi

@@ -25,3 +25,3 @@ * Released under the MIT License.

var RE_NARGS = /\{([0-9a-zA-Z]+)\}/g;
var RE_NARGS = /(%|)\{([0-9a-zA-Z]+)\}/g;

@@ -49,3 +49,3 @@ /**

return string.replace(RE_NARGS, function (match, i, index) {
return string.replace(RE_NARGS, function (match, prefix, i, index) {
var result = undefined;

@@ -239,3 +239,3 @@

plugin.version = '2.4.0';
plugin.version = '2.4.1';

@@ -242,0 +242,0 @@ return plugin;

/*!
* vue-i18n v2.4.0
* vue-i18n v2.4.1
* (c) 2016 kazuya kawaguchi
* Released under the MIT License.
*/
!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):r.VueI18n=n()}(this,function(){"use strict";function r(r){for(var n=arguments.length,t=Array(n>1?n-1:0),e=1;n>e;e++)t[e-1]=arguments[e];return 1===t.length&&"object"===i["typeof"](t[0])&&(t=t[0]),t&&t.hasOwnProperty||(t={}),r.replace(a,function(n,e,o){var u=void 0;return"{"===r[o-1]&&"}"===r[o+n.length]?e:(u=t.hasOwnProperty(e)?t[e]:null,null===u||void 0===u?"":u)})}function n(r){var n=r.split("."),t=n.splice(0,2);return t.push(n.join(".")),t}function t(r,t){for(var e=n(r),o=n(t),u=0;3>u;u++){var i=parseInt(e[u]||0,10),a=parseInt(o[u]||0,10);if(i>a)return 1;if(a>i)return-1}if((e[2]+o[2]+"").indexOf("-")>-1){var s=(f.exec(e[2])||[""])[0],c=(f.exec(o[2])||[""])[0];if(""===s)return 1;if(""===c)return-1;if(s>c)return 1;if(c>s)return-1}return 0}function e(n,e){function o(n,t,o){var i=n;try{var a=u(e[t],n)||e[t][n];i=(o?r(a,o):a)||n}catch(f){i=n}return i}var u=n.version&&-1===t("1.0.8",n.version)?n.parsers.path.getPath:n.parsers.path.get,i=n.util;return n.t=function(r){for(var t=arguments.length,e=Array(t>1?t-1:0),u=1;t>u;u++)e[u-1]=arguments[u];if(!r)return"";var a=n.config.lang;return 1===e.length?i.isObject(e[0])||i.isArray(e[0])?e=e[0]:"string"==typeof e[0]&&(a=e[0]):2===e.length&&("string"==typeof e[0]&&(a=e[0]),(i.isObject(e[1])||i.isArray(e[1]))&&(e=e[1])),o(r,a,e)},n.prototype.$t=function(r){for(var t=arguments.length,e=Array(t>1?t-1:0),o=1;t>o;o++)e[o-1]=arguments[o];return n.t.apply(n,[r].concat(e))},n}function o(r){var n=arguments.length<=1||void 0===arguments[1]?{lang:"en",locales:{}}:arguments[1];u(r.config,n.lang),e(r,n.locales)}function u(r,n){Object.defineProperty(r,"lang",{get:function(){return n},set:function(r){n=r}})}var i={};i["typeof"]=function(r){return r&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r};var a=/\{([0-9a-zA-Z]+)\}/g,f=/-([\w-.]+)/;return o.version="2.4.0",o});
!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):r.VueI18n=n()}(this,function(){"use strict";function r(r){for(var n=arguments.length,t=Array(n>1?n-1:0),e=1;n>e;e++)t[e-1]=arguments[e];return 1===t.length&&"object"===f["typeof"](t[0])&&(t=t[0]),t&&t.hasOwnProperty||(t={}),r.replace(u,function(n,e,o,i){var f=void 0;return"{"===r[i-1]&&"}"===r[i+n.length]?o:(f=t.hasOwnProperty(o)?t[o]:null,null===f||void 0===f?"":f)})}function n(r){var n=r.split("."),t=n.splice(0,2);return t.push(n.join(".")),t}function t(r,t){for(var e=n(r),o=n(t),i=0;3>i;i++){var f=parseInt(e[i]||0,10),u=parseInt(o[i]||0,10);if(f>u)return 1;if(u>f)return-1}if((e[2]+o[2]+"").indexOf("-")>-1){var c=(a.exec(e[2])||[""])[0],l=(a.exec(o[2])||[""])[0];if(""===c)return 1;if(""===l)return-1;if(c>l)return 1;if(l>c)return-1}return 0}function e(n,e){function o(n,t,o){var f=n;try{var u=i(e[t],n)||e[t][n];f=(o?r(u,o):u)||n}catch(a){f=n}return f}var i=n.version&&-1===t("1.0.8",n.version)?n.parsers.path.getPath:n.parsers.path.get,f=n.util;return n.t=function(r){for(var t=arguments.length,e=Array(t>1?t-1:0),i=1;t>i;i++)e[i-1]=arguments[i];if(!r)return"";var u=n.config.lang;return 1===e.length?f.isObject(e[0])||f.isArray(e[0])?e=e[0]:"string"==typeof e[0]&&(u=e[0]):2===e.length&&("string"==typeof e[0]&&(u=e[0]),(f.isObject(e[1])||f.isArray(e[1]))&&(e=e[1])),o(r,u,e)},n.prototype.$t=function(r){for(var t=arguments.length,e=Array(t>1?t-1:0),o=1;t>o;o++)e[o-1]=arguments[o];return n.t.apply(n,[r].concat(e))},n}function o(r){var n=arguments.length<=1||void 0===arguments[1]?{lang:"en",locales:{}}:arguments[1];i(r.config,n.lang),e(r,n.locales)}function i(r,n){Object.defineProperty(r,"lang",{get:function(){return n},set:function(r){n=r}})}var f={};f["typeof"]=function(r){return r&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r};var u=/(%|)\{([0-9a-zA-Z]+)\}/g,a=/-([\w-.]+)/;return o.version="2.4.1",o});
{
"name": "vue-i18n",
"description": "Internationalization plugin for Vue.js",
"version": "2.4.0",
"version": "2.4.1",
"author": {

@@ -25,4 +25,7 @@ "name": "kazuya kawaguchi",

"cz-conventional-changelog": "^1.1.4",
"eslint": "^1.10.2",
"eslint-loader": "^1.1.1",
"eslint": "^2.2.0",
"eslint-config-standard": "^5.1.0",
"eslint-loader": "^1.3.0",
"eslint-plugin-promise": "^1.0.8",
"eslint-plugin-standard": "^1.3.2",
"espower-babel": "^4.0.0",

@@ -88,3 +91,3 @@ "istanbul-instrumenter-loader": "^0.1.3",

"ie": "VUE_I18N_TYPE=sauce SAUCE=batch2 karma start config/karma.conf.js",
"lint": "eslint src test config",
"lint": "eslint src/*.js test/**/*.js config/*.js",
"mobile": "VUE_I18N_TYPE=sauce SAUCE=batch3 karma start config/karma.conf.js",

@@ -91,0 +94,0 @@ "sauce": "npm run coolkids && npm run ie && npm run mobile",

@@ -84,3 +84,33 @@ # vue-i18n

# Formatting
## HTML formatting
In some cases you might want to rendered your translation as an HTML message and not a static string.
```javascript
var locales = {
en: {
message: {
hello: 'hello <br> world'
}
}
}
```
Template the following (notice the tripple brackets):
```html
<div class="message">
<p>{{{ $t('message.hello') }}}</p>
</div>
```
Output the following (instead of the message pre formatted)
```html
<div class="message">
<p>hello
<!--<br> exists but is rendered as html and not a string-->
world</p>
</div>
```
## Named formatting

@@ -147,2 +177,34 @@

# Interpolation format
## Support ruby on rails i18n format
Locale the following:
```javascript
var locales = {
en: {
message: {
hello: '%{msg} world'
}
}
}
```
Template the following:
```html
<div class="message">
<p>{{ $t('message.hello', { msg: "hello"}) }}</p>
</div>
```
Output the following:
```html
<div class="message">
<p>hello world</p>
</div>
```
# API

@@ -149,0 +211,0 @@

@@ -7,3 +7,3 @@ /**

const RE_NARGS = /\{([0-9a-zA-Z]+)\}/g
const RE_NARGS = /(%|)\{([0-9a-zA-Z]+)\}/g

@@ -28,3 +28,3 @@

return string.replace(RE_NARGS, (match, i, index) => {
return string.replace(RE_NARGS, (match, prefix, i, index) => {
let result

@@ -31,0 +31,0 @@

@@ -34,4 +34,4 @@ import extend from './extend'

plugin.version = '2.4.0'
plugin.version = '2.4.1'
export default plugin
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