Socket
Socket
Sign inDemoInstall

vue3-i18n

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue3-i18n - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

2

dist/vue3-i18n.common.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue");const t=Symbol("i18n"),r=(e,t,n)=>{const o=e[0];if(~o.indexOf("[")){const[s,l]=o.split("["),a=parseInt(l.replace("]",""));if(a>-1){if(!t[s]&&t[s].length>0&&t[s][a]&&""!==t[s][a])throw new Error("Not Found");return 1===e.length?"string"==typeof t[s][a]?t[s][a]:"":r(e.slice(1),t[s][a],n)}throw new Error(`Not Found: ${o}`)}if(t[e[0]]||""===t[e[0]]){if(1===e.length){let r="string"==typeof t[e[0]]?t[e[0]]:"";return n&&(r=((e,t)=>{const r=/{(\w*)}/g;let n,o=e;for(;null!==(n=r.exec(e));){if(!Object.prototype.hasOwnProperty.call(t,n[1]))throw new Error(`Not Found Params: ${n[1]}`);o=o.replace(n[0],t[n[1]])}return o})(r,n)),r}return r(e.slice(1),t[e[0]],n)}throw new Error("Not Found")};exports.createI18n=n=>{const o=e.ref(n.locale||"en"),s=n.messages;return{messages:s,t:(e,t)=>{const n=s[o.value]||s.en;if("string"!=typeof e)return console.warn("Warn(i18n):","keypath must be a type of string"),"";try{return r(e.split("."),n,t)}catch(t){return console.warn(`Warn(i18n): the keypath '${e}' not found`),""}},setLocale:e=>{s[e]||console.warn(`Warn(i18n): the '${e}' language pack not found, fall back to English language pack`),o.value=e},getLocale:()=>o.value,install(e){const r=this;e.provide(t,r),e.config.globalProperties.$t=r.t,e.config.globalProperties.$i18n=r}}},exports.i18nSymbol=t,exports.useI18n=function(){return e.inject(t)};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue");const t=Symbol("i18n"),n=(e,t,r)=>{const o=e[0];if(~o.indexOf("[")){const[l,s]=o.split("["),a=parseInt(s.replace("]",""));if(a>-1){if(!t[l]&&t[l].length>0&&t[l][a]&&""!==t[l][a])throw new Error("Not Found");return 1===e.length?"string"==typeof t[l][a]?t[l][a]:"":n(e.slice(1),t[l][a],r)}throw new Error(`Not Found: ${o}`)}if(t[e[0]]||""===t[e[0]]){if(1===e.length){let n="string"==typeof t[e[0]]?t[e[0]]:"";return r&&(n=((e,t)=>{const n=/{(\w*)}/g;let r,o=e;for(;null!==(r=n.exec(e));){if(console.log(r),!Object.prototype.hasOwnProperty.call(t,r[1]))throw new Error(`Not Found Params: ${r[1]}`);o=o.replace(r[0],t[r[1]])}return o})(n,r)),n}return n(e.slice(1),t[e[0]],r)}throw new Error("Not Found")};exports.createI18n=r=>{const o=e.ref(r.locale||"en"),l=r.messages;return{messages:l,t:(e,t)=>{const r=l[o.value]||l.en;if("string"!=typeof e)return console.warn("Warn(i18n):","keypath must be a type of string"),"";try{return n(e.split("."),r,t)}catch(t){return console.log(t),console.warn(`Warn(i18n): the keypath '${e}' not found`),""}},setLocale:e=>{l[e]||console.warn(`Warn(i18n): the '${e}' language pack not found, fall back to English language pack`),o.value=e},getLocale:()=>o.value,install(e){const n=this;e.provide(t,n),e.config.globalProperties.$t=n.t,e.config.globalProperties.$i18n=n}}},exports.i18nSymbol=t,exports.useI18n=function(){return e.inject(t)};

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

import{ref as e,inject as t}from"vue";const n=Symbol("i18n"),r=(e,t,n)=>{const o=e[0];if(~o.indexOf("[")){const[l,a]=o.split("["),s=parseInt(a.replace("]",""));if(s>-1){if(!t[l]&&t[l].length>0&&t[l][s]&&""!==t[l][s])throw new Error("Not Found");return 1===e.length?"string"==typeof t[l][s]?t[l][s]:"":r(e.slice(1),t[l][s],n)}throw new Error(`Not Found: ${o}`)}if(t[e[0]]||""===t[e[0]]){if(1===e.length){let r="string"==typeof t[e[0]]?t[e[0]]:"";return n&&(r=((e,t)=>{const n=/{(\w*)}/g;let r,o=e;for(;null!==(r=n.exec(e));){if(!Object.prototype.hasOwnProperty.call(t,r[1]))throw new Error(`Not Found Params: ${r[1]}`);o=o.replace(r[0],t[r[1]])}return o})(r,n)),r}return r(e.slice(1),t[e[0]],n)}throw new Error("Not Found")},o=t=>{const o=e(t.locale||"en"),l=t.messages;return{messages:l,t:(e,t)=>{const n=l[o.value]||l.en;if("string"!=typeof e)return console.warn("Warn(i18n):","keypath must be a type of string"),"";try{return r(e.split("."),n,t)}catch(t){return console.warn(`Warn(i18n): the keypath '${e}' not found`),""}},setLocale:e=>{l[e]||console.warn(`Warn(i18n): the '${e}' language pack not found, fall back to English language pack`),o.value=e},getLocale:()=>o.value,install(e){const t=this;e.provide(n,t),e.config.globalProperties.$t=t.t,e.config.globalProperties.$i18n=t}}};function l(){return t(n)}export{o as createI18n,n as i18nSymbol,l as useI18n};
import{ref as e,inject as t}from"vue";const n=Symbol("i18n"),o=(e,t,n)=>{const r=e[0];if(~r.indexOf("[")){const[l,a]=r.split("["),s=parseInt(a.replace("]",""));if(s>-1){if(!t[l]&&t[l].length>0&&t[l][s]&&""!==t[l][s])throw new Error("Not Found");return 1===e.length?"string"==typeof t[l][s]?t[l][s]:"":o(e.slice(1),t[l][s],n)}throw new Error(`Not Found: ${r}`)}if(t[e[0]]||""===t[e[0]]){if(1===e.length){let o="string"==typeof t[e[0]]?t[e[0]]:"";return n&&(o=((e,t)=>{const n=/{(\w*)}/g;let o,r=e;for(;null!==(o=n.exec(e));){if(console.log(o),!Object.prototype.hasOwnProperty.call(t,o[1]))throw new Error(`Not Found Params: ${o[1]}`);r=r.replace(o[0],t[o[1]])}return r})(o,n)),o}return o(e.slice(1),t[e[0]],n)}throw new Error("Not Found")},r=t=>{const r=e(t.locale||"en"),l=t.messages;return{messages:l,t:(e,t)=>{const n=l[r.value]||l.en;if("string"!=typeof e)return console.warn("Warn(i18n):","keypath must be a type of string"),"";try{return o(e.split("."),n,t)}catch(t){return console.log(t),console.warn(`Warn(i18n): the keypath '${e}' not found`),""}},setLocale:e=>{l[e]||console.warn(`Warn(i18n): the '${e}' language pack not found, fall back to English language pack`),r.value=e},getLocale:()=>r.value,install(e){const t=this;e.provide(n,t),e.config.globalProperties.$t=t.t,e.config.globalProperties.$i18n=t}}};function l(){return t(n)}export{r as createI18n,n as i18nSymbol,l as useI18n};

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).Vue3I18n={},e.Vue)}(this,(function(e,n){"use strict";const t=Symbol("i18n"),o=(e,n,t)=>{const r=e[0];if(~r.indexOf("[")){const[i,l]=r.split("["),s=parseInt(l.replace("]",""));if(s>-1){if(!n[i]&&n[i].length>0&&n[i][s]&&""!==n[i][s])throw new Error("Not Found");return 1===e.length?"string"==typeof n[i][s]?n[i][s]:"":o(e.slice(1),n[i][s],t)}throw new Error(`Not Found: ${r}`)}if(n[e[0]]||""===n[e[0]]){if(1===e.length){let o="string"==typeof n[e[0]]?n[e[0]]:"";return t&&(o=((e,n)=>{const t=/{(\w*)}/g;let o,r=e;for(;null!==(o=t.exec(e));){if(!Object.prototype.hasOwnProperty.call(n,o[1]))throw new Error(`Not Found Params: ${o[1]}`);r=r.replace(o[0],n[o[1]])}return r})(o,t)),o}return o(e.slice(1),n[e[0]],t)}throw new Error("Not Found")};e.createI18n=e=>{const r=n.ref(e.locale||"en"),i=e.messages;return{messages:i,t:(e,n)=>{const t=i[r.value]||i.en;if("string"!=typeof e)return console.warn("Warn(i18n):","keypath must be a type of string"),"";try{return o(e.split("."),t,n)}catch(n){return console.warn(`Warn(i18n): the keypath '${e}' not found`),""}},setLocale:e=>{i[e]||console.warn(`Warn(i18n): the '${e}' language pack not found, fall back to English language pack`),r.value=e},getLocale:()=>r.value,install(e){const n=this;e.provide(t,n),e.config.globalProperties.$t=n.t,e.config.globalProperties.$i18n=n}}},e.i18nSymbol=t,e.useI18n=function(){return n.inject(t)},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).Vue3I18n={},e.Vue)}(this,(function(e,n){"use strict";const t=Symbol("i18n"),o=(e,n,t)=>{const r=e[0];if(~r.indexOf("[")){const[l,s]=r.split("["),i=parseInt(s.replace("]",""));if(i>-1){if(!n[l]&&n[l].length>0&&n[l][i]&&""!==n[l][i])throw new Error("Not Found");return 1===e.length?"string"==typeof n[l][i]?n[l][i]:"":o(e.slice(1),n[l][i],t)}throw new Error(`Not Found: ${r}`)}if(n[e[0]]||""===n[e[0]]){if(1===e.length){let o="string"==typeof n[e[0]]?n[e[0]]:"";return t&&(o=((e,n)=>{const t=/{(\w*)}/g;let o,r=e;for(;null!==(o=t.exec(e));){if(console.log(o),!Object.prototype.hasOwnProperty.call(n,o[1]))throw new Error(`Not Found Params: ${o[1]}`);r=r.replace(o[0],n[o[1]])}return r})(o,t)),o}return o(e.slice(1),n[e[0]],t)}throw new Error("Not Found")};e.createI18n=e=>{const r=n.ref(e.locale||"en"),l=e.messages;return{messages:l,t:(e,n)=>{const t=l[r.value]||l.en;if("string"!=typeof e)return console.warn("Warn(i18n):","keypath must be a type of string"),"";try{return o(e.split("."),t,n)}catch(n){return console.log(n),console.warn(`Warn(i18n): the keypath '${e}' not found`),""}},setLocale:e=>{l[e]||console.warn(`Warn(i18n): the '${e}' language pack not found, fall back to English language pack`),r.value=e},getLocale:()=>r.value,install(e){const n=this;e.provide(t,n),e.config.globalProperties.$t=n.t,e.config.globalProperties.$i18n=n}}},e.i18nSymbol=t,e.useI18n=function(){return n.inject(t)},Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "vue3-i18n",
"version": "1.1.3",
"version": "1.1.4",
"description": "A i18n plugin for Vue3",
"main": "dist/index.common.js",
"module": "dist/index.esm.js",
"main": "dist/vue3-i18n.common.js",
"module": "dist/vue3-i18n.esm.js",
"unpkg": "dist/vue3-i18n.js",

@@ -15,7 +15,10 @@ "types": "dist/index.d.ts",

"lint": "eslint src/* --fix",
"docs:dev": "npm run docs:dev --workspace=vue3-i18n-docs",
"docs:build": "npm run docs:build --workspace=vue3-i18n-docs"
"docs:dev": "yarn workspace docs dev",
"docs:build": "yarn workspace docs build"
},
"publishConfig": {
"access": "public"
},
"workspaces": [
"packages/vue3-i18n-docs"
"packages/*"
],

@@ -40,5 +43,2 @@ "files": [

},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"devDependencies": {

@@ -61,2 +61,3 @@ "@babel/core": "^7.12.9",

"eslint-plugin-standard": "^4.1.0",
"lerna": "^4.0.0",
"rollup": "^2.34.0",

@@ -66,3 +67,5 @@ "rollup-plugin-clear": "^2.0.7",

"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.29.0"
"rollup-plugin-typescript2": "^0.29.0",
"typescript": "^4.3.5",
"vue": "^3.1.5"
},

@@ -69,0 +72,0 @@ "peerDependencies": {

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