Comparing version 1.10.4 to 1.10.5
@@ -590,2 +590,7 @@ 'use strict'; | ||
// get all available locales | ||
var getLocales = function getLocales() { | ||
return Object.keys(store.state[moduleName].translations); | ||
}; | ||
// add predefined translations to the store (keeping existing information) | ||
@@ -633,2 +638,3 @@ var addLocale = function addLocale(locale, translations) { | ||
locale: getLocale, | ||
locales: getLocales, | ||
set: setLocale, | ||
@@ -642,2 +648,5 @@ add: addLocale, | ||
translate: translate, | ||
translateIn: translateInLanguage, | ||
exists: phaseOutExistsFn | ||
@@ -649,2 +658,3 @@ }; | ||
locale: getLocale, | ||
locales: getLocales, | ||
set: setLocale, | ||
@@ -663,6 +673,6 @@ add: addLocale, | ||
// register the translation function on the vue instance | ||
// register the translation function on the vue instance directly | ||
Vue.prototype.$t = translate; | ||
// register the specific language translation function on the vue instance | ||
// register the specific language translation function on the vue instance directly | ||
Vue.prototype.$tlang = translateInLanguage; | ||
@@ -669,0 +679,0 @@ |
@@ -588,2 +588,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
// get all available locales | ||
var getLocales = function getLocales() { | ||
return Object.keys(store.state[moduleName].translations); | ||
}; | ||
// add predefined translations to the store (keeping existing information) | ||
@@ -631,2 +636,3 @@ var addLocale = function addLocale(locale, translations) { | ||
locale: getLocale, | ||
locales: getLocales, | ||
set: setLocale, | ||
@@ -640,2 +646,5 @@ add: addLocale, | ||
translate: translate, | ||
translateIn: translateInLanguage, | ||
exists: phaseOutExistsFn | ||
@@ -647,2 +656,3 @@ }; | ||
locale: getLocale, | ||
locales: getLocales, | ||
set: setLocale, | ||
@@ -661,6 +671,6 @@ add: addLocale, | ||
// register the translation function on the vue instance | ||
// register the translation function on the vue instance directly | ||
Vue.prototype.$t = translate; | ||
// register the specific language translation function on the vue instance | ||
// register the specific language translation function on the vue instance directly | ||
Vue.prototype.$tlang = translateInLanguage; | ||
@@ -667,0 +677,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.vuexI18n=t()}(this,function(){"use strict";function e(e){return!!e&&Array===e.constructor}function t(e){return!!e&&Array===e.constructor}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a={namespaced:!0,state:{locale:null,fallback:null,translations:{}},mutations:{SET_LOCALE:function e(t,n){t.locale=n.locale},ADD_LOCALE:function e(t,n){var a=r(n.translations);if(t.translations.hasOwnProperty(n.locale)){var o=t.translations[n.locale];t.translations[n.locale]=Object.assign({},o,a)}else t.translations[n.locale]=a;try{t.translations.__ob__&&t.translations.__ob__.dep.notify()}catch(e){}},REPLACE_LOCALE:function e(t,n){var a=r(n.translations);t.translations[n.locale]=a;try{t.translations.__ob__&&t.translations.__ob__.dep.notify()}catch(e){}},REMOVE_LOCALE:function e(t,n){if(t.translations.hasOwnProperty(n.locale)){t.locale===n.locale&&(t.locale=null);var a=Object.assign({},t.translations);delete a[n.locale],t.translations=a}},SET_FALLBACK_LOCALE:function e(t,n){t.fallback=n.locale}},actions:{setLocale:function e(t,n){t.commit({type:"SET_LOCALE",locale:n.locale})},addLocale:function e(t,n){t.commit({type:"ADD_LOCALE",locale:n.locale,translations:n.translations})},replaceLocale:function e(t,n){t.commit({type:"REPLACE_LOCALE",locale:n.locale,translations:n.translations})},removeLocale:function e(t,n){t.commit({type:"REMOVE_LOCALE",locale:n.locale,translations:n.translations})},setFallbackLocale:function e(t,n){t.commit({type:"SET_FALLBACK_LOCALE",locale:n.locale})}}},r=function t(a){var r={};for(var o in a)if(a.hasOwnProperty(o)){var s=n(a[o]);if(e(a[o])){for(var l=a[o].length,c=0;c<l;c++){var i=n(a[o][c]);if("string"!==i){console.warn("i18n:","currently only arrays of strings are fully supported",a[o]);break}}r[o]=a[o]}else if("object"==s&&null!==s){var u=t(a[o]);for(var f in u)u.hasOwnProperty(f)&&(r[o+"."+f]=u[f])}else r[o]=a[o]}return r},o={getTranslationIndex:function e(t,n){switch(t){case"ay":case"bo":case"cgg":case"dz":case"fa":case"id":case"ja":case"jbo":case"ka":case"kk":case"km":case"ko":case"ky":case"lo":case"ms":case"my":case"sah":case"su":case"th":case"tt":case"ug":case"vi":case"wo":case"zh":return 0;case"is":return n%10!=1||n%100==11?1:0;case"jv":return 0!==n?1:0;case"mk":return 1===n||n%10==1?0:1;case"ach":case"ak":case"am":case"arn":case"br":case"fil":case"fr":case"gun":case"ln":case"mfe":case"mg":case"mi":case"oc":case"pt_BR":case"tg":case"ti":case"tr":case"uz":case"wa":case"zh":return n>1?1:0;case"lv":return n%10==1&&n%100!=11?0:0!==n?1:2;case"lt":return n%10==1&&n%100!=11?0:n%10>=2&&(n%100<10||n%100>=20)?1:2;case"be":case"bs":case"hr":case"ru":case"sr":case"uk":return n%10==1&&n%100!=11?0:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?1:2;case"mnk":return 0===n?0:1===n?1:2;case"ro":return 1===n?0:0===n||n%100>0&&n%100<20?1:2;case"pl":return 1===n?0:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?1:2;case"cs":case"sk":return 1===n?0:n>=2&&n<=4?1:2;case"csb":return 1===n?0:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?1:2;case"sl":return n%100==1?0:n%100==2?1:n%100==3||n%100==4?2:3;case"mt":return 1===n?0:0===n||n%100>1&&n%100<11?1:n%100>10&&n%100<20?2:3;case"gd":return 1===n||11===n?0:2===n||12===n?1:n>2&&n<20?2:3;case"cy":return 1===n?0:2===n?1:8!==n&&11!==n?2:3;case"kw":return 1===n?0:2===n?1:3===n?2:3;case"ga":return 1===n?0:2===n?1:n>2&&n<7?2:n>6&&n<11?3:4;case"ar":return 0===n?0:1===n?1:2===n?2:n%100>=3&&n%100<=10?3:n%100>=11?4:5;default:return 1!==n?1:0}}},s={};s.install=function e(t,n,r){"string"!=typeof arguments[2]&&"string"!=typeof arguments[3]||(console.warn("i18n: Registering the plugin vuex-i18n with a string for `moduleName` or `identifiers` is deprecated. Use a configuration object instead.","https://github.com/dkfbasel/vuex-i18n#setup"),r={moduleName:arguments[2],identifiers:arguments[3]});var o=Object.assign({moduleName:"i18n",identifiers:["{","}"],preserveState:!1,onTranslationNotFound:function e(){}},r),s=o.moduleName,c=o.identifiers,i=o.onTranslationNotFound;if("function"!=typeof i&&(console.error("i18n: i18n config option onTranslationNotFound must be a function"),i=function e(){}),n.registerModule(s,a,{preserveState:o.preserveState}),!1===n.state.hasOwnProperty(s))return console.error("i18n: i18n vuex module is not correctly initialized. Please check the module name:",s),t.prototype.$i18n=function(e){return e},t.prototype.$getLanguage=function(){return null},void(t.prototype.$setLanguage=function(){console.error("i18n: i18n vuex module is not correctly initialized")});var u=l(c),f=function e(){var t=n.state[s].locale;return p.apply(void 0,[t].concat(Array.prototype.slice.call(arguments)))},p=function e(t){var a=arguments,r="",o="",l={},c=null,f=a.length;if(f>=3&&"string"==typeof a[2]?(r=a[1],o=a[2],f>3&&(l=a[3]),f>4&&(c=a[4])):(r=a[1],o=r,f>2&&(l=a[2]),f>3&&(c=a[3])),!t)return console.warn("i18n: i18n locale is not set when trying to access translations:",r),o;var p=n.state[s].translations,d=n.state[s].fallback,y=t.split("-"),h=!0;if(!1===p.hasOwnProperty(t)?h=!1:!1===p[t].hasOwnProperty(r)&&(h=!1),!0===h)return u(t,p[t][r],l,c);if(y.length>1&&!0===p.hasOwnProperty(y[0])&&!0===p[y[0]].hasOwnProperty(r))return u(y[0],p[y[0]][r],l,c);var m=i(t,r,o);return m&&Promise.resolve(m).then(function(e){var n={};n[r]=e,v(t,n)}),!1===p.hasOwnProperty(d)?u(t,o,l,c):!1===p[d].hasOwnProperty(r)?u(d,o,l,c):u(t,p[d][r],l,c)},d=function e(t){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"fallback",r=n.state[s].locale,o=n.state[s].fallback,l=n.state[s].translations;if(l.hasOwnProperty(r)&&l[r].hasOwnProperty(t))return!0;if("strict"==a)return!1;var c=r.split("-");return!!(c.length>1&&l.hasOwnProperty(c[0])&&l[c[0]].hasOwnProperty(t))||"locale"!=a&&!(!l.hasOwnProperty(o)||!l[o].hasOwnProperty(t))},y=function e(t){n.dispatch({type:s+"/setFallbackLocale",locale:t})},h=function e(t){n.dispatch({type:s+"/setLocale",locale:t})},m=function e(){return n.state[s].locale},v=function e(t,a){return n.dispatch({type:s+"/addLocale",locale:t,translations:a})},g=function e(t,a){return n.dispatch({type:s+"/replaceLocale",locale:t,translations:a})},b=function e(t){n.state[s].translations.hasOwnProperty(t)&&n.dispatch({type:s+"/removeLocale",locale:t})},L=function e(t){return console.warn("i18n: $i18n.exists is depreceated. Please use $i18n.localeExists instead. It provides exatly the same functionality."),w(t)},w=function e(t){return n.state[s].translations.hasOwnProperty(t)};t.prototype.$i18n={locale:m,set:h,add:v,replace:g,remove:b,fallback:y,localeExists:w,keyExists:d,exists:L},t.i18n={locale:m,set:h,add:v,replace:g,remove:b,fallback:y,translate:f,translateIn:p,localeExists:w,keyExists:d,exists:L},t.prototype.$t=f,t.prototype.$tlang=p,t.filter("translate",f)};var l=function e(a){null!=a&&2==a.length||console.warn("i18n: You must specify the start and end character identifying variable substitutions");var r=new RegExp(a[0]+"\\w+"+a[1],"g"),s=function e(t,n){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return t.replace?t.replace(r,function(e){var r=e.replace(a[0],"").replace(a[1],"");return void 0!==n[r]?n[r]:(!0===o&&(console.group?console.group("i18n: Not all placeholders found"):console.warn("i18n: Not all placeholders found"),console.warn("Text:",t),console.warn("Placeholder:",e),console.groupEnd&&console.groupEnd()),e)}):t};return function e(a,r){var l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=void 0===r?"undefined":n(r),u=void 0===c?"undefined":n(c),f=function e(){return t(r)?r.map(function(e){return s(e,l,!1)}):"string"===i?s(r,l,!0):void 0};if(null===c)return f();if("number"!==u)return console.warn("i18n: pluralization is not a number"),f();var p=f(),d=null;d=t(p)&&p.length>0?p:p.split(":::");var y=o.getTranslationIndex(a,c);return void 0===d[y]?(console.warn("i18n: pluralization not provided in locale",r,a,y),d[0].trim()):d[y].trim()}};return{store:a,plugin:s}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.vuexI18n=t()}(this,function(){"use strict";function e(e){return!!e&&Array===e.constructor}function t(e){return!!e&&Array===e.constructor}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a={namespaced:!0,state:{locale:null,fallback:null,translations:{}},mutations:{SET_LOCALE:function e(t,n){t.locale=n.locale},ADD_LOCALE:function e(t,n){var a=r(n.translations);if(t.translations.hasOwnProperty(n.locale)){var o=t.translations[n.locale];t.translations[n.locale]=Object.assign({},o,a)}else t.translations[n.locale]=a;try{t.translations.__ob__&&t.translations.__ob__.dep.notify()}catch(e){}},REPLACE_LOCALE:function e(t,n){var a=r(n.translations);t.translations[n.locale]=a;try{t.translations.__ob__&&t.translations.__ob__.dep.notify()}catch(e){}},REMOVE_LOCALE:function e(t,n){if(t.translations.hasOwnProperty(n.locale)){t.locale===n.locale&&(t.locale=null);var a=Object.assign({},t.translations);delete a[n.locale],t.translations=a}},SET_FALLBACK_LOCALE:function e(t,n){t.fallback=n.locale}},actions:{setLocale:function e(t,n){t.commit({type:"SET_LOCALE",locale:n.locale})},addLocale:function e(t,n){t.commit({type:"ADD_LOCALE",locale:n.locale,translations:n.translations})},replaceLocale:function e(t,n){t.commit({type:"REPLACE_LOCALE",locale:n.locale,translations:n.translations})},removeLocale:function e(t,n){t.commit({type:"REMOVE_LOCALE",locale:n.locale,translations:n.translations})},setFallbackLocale:function e(t,n){t.commit({type:"SET_FALLBACK_LOCALE",locale:n.locale})}}},r=function t(a){var r={};for(var o in a)if(a.hasOwnProperty(o)){var s=n(a[o]);if(e(a[o])){for(var l=a[o].length,c=0;c<l;c++){var i=n(a[o][c]);if("string"!==i){console.warn("i18n:","currently only arrays of strings are fully supported",a[o]);break}}r[o]=a[o]}else if("object"==s&&null!==s){var u=t(a[o]);for(var f in u)u.hasOwnProperty(f)&&(r[o+"."+f]=u[f])}else r[o]=a[o]}return r},o={getTranslationIndex:function e(t,n){switch(t){case"ay":case"bo":case"cgg":case"dz":case"fa":case"id":case"ja":case"jbo":case"ka":case"kk":case"km":case"ko":case"ky":case"lo":case"ms":case"my":case"sah":case"su":case"th":case"tt":case"ug":case"vi":case"wo":case"zh":return 0;case"is":return n%10!=1||n%100==11?1:0;case"jv":return 0!==n?1:0;case"mk":return 1===n||n%10==1?0:1;case"ach":case"ak":case"am":case"arn":case"br":case"fil":case"fr":case"gun":case"ln":case"mfe":case"mg":case"mi":case"oc":case"pt_BR":case"tg":case"ti":case"tr":case"uz":case"wa":case"zh":return n>1?1:0;case"lv":return n%10==1&&n%100!=11?0:0!==n?1:2;case"lt":return n%10==1&&n%100!=11?0:n%10>=2&&(n%100<10||n%100>=20)?1:2;case"be":case"bs":case"hr":case"ru":case"sr":case"uk":return n%10==1&&n%100!=11?0:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?1:2;case"mnk":return 0===n?0:1===n?1:2;case"ro":return 1===n?0:0===n||n%100>0&&n%100<20?1:2;case"pl":return 1===n?0:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?1:2;case"cs":case"sk":return 1===n?0:n>=2&&n<=4?1:2;case"csb":return 1===n?0:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?1:2;case"sl":return n%100==1?0:n%100==2?1:n%100==3||n%100==4?2:3;case"mt":return 1===n?0:0===n||n%100>1&&n%100<11?1:n%100>10&&n%100<20?2:3;case"gd":return 1===n||11===n?0:2===n||12===n?1:n>2&&n<20?2:3;case"cy":return 1===n?0:2===n?1:8!==n&&11!==n?2:3;case"kw":return 1===n?0:2===n?1:3===n?2:3;case"ga":return 1===n?0:2===n?1:n>2&&n<7?2:n>6&&n<11?3:4;case"ar":return 0===n?0:1===n?1:2===n?2:n%100>=3&&n%100<=10?3:n%100>=11?4:5;default:return 1!==n?1:0}}},s={};s.install=function e(t,n,r){"string"!=typeof arguments[2]&&"string"!=typeof arguments[3]||(console.warn("i18n: Registering the plugin vuex-i18n with a string for `moduleName` or `identifiers` is deprecated. Use a configuration object instead.","https://github.com/dkfbasel/vuex-i18n#setup"),r={moduleName:arguments[2],identifiers:arguments[3]});var o=Object.assign({moduleName:"i18n",identifiers:["{","}"],preserveState:!1,onTranslationNotFound:function e(){}},r),s=o.moduleName,c=o.identifiers,i=o.onTranslationNotFound;if("function"!=typeof i&&(console.error("i18n: i18n config option onTranslationNotFound must be a function"),i=function e(){}),n.registerModule(s,a,{preserveState:o.preserveState}),!1===n.state.hasOwnProperty(s))return console.error("i18n: i18n vuex module is not correctly initialized. Please check the module name:",s),t.prototype.$i18n=function(e){return e},t.prototype.$getLanguage=function(){return null},void(t.prototype.$setLanguage=function(){console.error("i18n: i18n vuex module is not correctly initialized")});var u=l(c),f=function e(){var t=n.state[s].locale;return p.apply(void 0,[t].concat(Array.prototype.slice.call(arguments)))},p=function e(t){var a=arguments,r="",o="",l={},c=null,f=a.length;if(f>=3&&"string"==typeof a[2]?(r=a[1],o=a[2],f>3&&(l=a[3]),f>4&&(c=a[4])):(r=a[1],o=r,f>2&&(l=a[2]),f>3&&(c=a[3])),!t)return console.warn("i18n: i18n locale is not set when trying to access translations:",r),o;var p=n.state[s].translations,d=n.state[s].fallback,y=t.split("-"),h=!0;if(!1===p.hasOwnProperty(t)?h=!1:!1===p[t].hasOwnProperty(r)&&(h=!1),!0===h)return u(t,p[t][r],l,c);if(y.length>1&&!0===p.hasOwnProperty(y[0])&&!0===p[y[0]].hasOwnProperty(r))return u(y[0],p[y[0]][r],l,c);var m=i(t,r,o);return m&&Promise.resolve(m).then(function(e){var n={};n[r]=e,g(t,n)}),!1===p.hasOwnProperty(d)?u(t,o,l,c):!1===p[d].hasOwnProperty(r)?u(d,o,l,c):u(t,p[d][r],l,c)},d=function e(t){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"fallback",r=n.state[s].locale,o=n.state[s].fallback,l=n.state[s].translations;if(l.hasOwnProperty(r)&&l[r].hasOwnProperty(t))return!0;if("strict"==a)return!1;var c=r.split("-");return!!(c.length>1&&l.hasOwnProperty(c[0])&&l[c[0]].hasOwnProperty(t))||"locale"!=a&&!(!l.hasOwnProperty(o)||!l[o].hasOwnProperty(t))},y=function e(t){n.dispatch({type:s+"/setFallbackLocale",locale:t})},h=function e(t){n.dispatch({type:s+"/setLocale",locale:t})},m=function e(){return n.state[s].locale},v=function e(){return Object.keys(n.state[s].translations)},g=function e(t,a){return n.dispatch({type:s+"/addLocale",locale:t,translations:a})},b=function e(t,a){return n.dispatch({type:s+"/replaceLocale",locale:t,translations:a})},L=function e(t){n.state[s].translations.hasOwnProperty(t)&&n.dispatch({type:s+"/removeLocale",locale:t})},w=function e(t){return console.warn("i18n: $i18n.exists is depreceated. Please use $i18n.localeExists instead. It provides exatly the same functionality."),O(t)},O=function e(t){return n.state[s].translations.hasOwnProperty(t)};t.prototype.$i18n={locale:m,locales:v,set:h,add:g,replace:b,remove:L,fallback:y,localeExists:O,keyExists:d,translate:f,translateIn:p,exists:w},t.i18n={locale:m,locales:v,set:h,add:g,replace:b,remove:L,fallback:y,translate:f,translateIn:p,localeExists:O,keyExists:d,exists:w},t.prototype.$t=f,t.prototype.$tlang=p,t.filter("translate",f)};var l=function e(a){null!=a&&2==a.length||console.warn("i18n: You must specify the start and end character identifying variable substitutions");var r=new RegExp(a[0]+"\\w+"+a[1],"g"),s=function e(t,n){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return t.replace?t.replace(r,function(e){var r=e.replace(a[0],"").replace(a[1],"");return void 0!==n[r]?n[r]:(!0===o&&(console.group?console.group("i18n: Not all placeholders found"):console.warn("i18n: Not all placeholders found"),console.warn("Text:",t),console.warn("Placeholder:",e),console.groupEnd&&console.groupEnd()),e)}):t};return function e(a,r){var l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=void 0===r?"undefined":n(r),u=void 0===c?"undefined":n(c),f=function e(){return t(r)?r.map(function(e){return s(e,l,!1)}):"string"===i?s(r,l,!0):void 0};if(null===c)return f();if("number"!==u)return console.warn("i18n: pluralization is not a number"),f();var p=f(),d=null;d=t(p)&&p.length>0?p:p.split(":::");var y=o.getTranslationIndex(a,c);return void 0===d[y]?(console.warn("i18n: pluralization not provided in locale",r,a,y),d[0].trim()):d[y].trim()}};return{store:a,plugin:s}}); |
@@ -594,2 +594,7 @@ (function (global, factory) { | ||
// get all available locales | ||
var getLocales = function getLocales() { | ||
return Object.keys(store.state[moduleName].translations); | ||
}; | ||
// add predefined translations to the store (keeping existing information) | ||
@@ -637,2 +642,3 @@ var addLocale = function addLocale(locale, translations) { | ||
locale: getLocale, | ||
locales: getLocales, | ||
set: setLocale, | ||
@@ -646,2 +652,5 @@ add: addLocale, | ||
translate: translate, | ||
translateIn: translateInLanguage, | ||
exists: phaseOutExistsFn | ||
@@ -653,2 +662,3 @@ }; | ||
locale: getLocale, | ||
locales: getLocales, | ||
set: setLocale, | ||
@@ -667,6 +677,6 @@ add: addLocale, | ||
// register the translation function on the vue instance | ||
// register the translation function on the vue instance directly | ||
Vue.prototype.$t = translate; | ||
// register the specific language translation function on the vue instance | ||
// register the specific language translation function on the vue instance directly | ||
Vue.prototype.$tlang = translateInLanguage; | ||
@@ -673,0 +683,0 @@ |
{ | ||
"name": "vuex-i18n", | ||
"version": "1.10.4", | ||
"version": "1.10.5", | ||
"description": "Easy localization for vue-components using vuex as data store", | ||
@@ -5,0 +5,0 @@ "directories": { |
@@ -41,4 +41,6 @@ # vuex-i18n | ||
// please note that the default format for the plugin is in es2015 | ||
// for use in server side rendering (such as nuxt), the umd version should be loaded like this | ||
// IMPORTANT NOTE: | ||
// The default format for the plugin is in es2015, if you do not use a transpiler | ||
// such as babel) or for use in server side rendering (such as nuxt) | ||
// the umd version should be loaded like this | ||
// import vuexI18n from 'vuex-i18n/dist/vuex-i18n.umd.js'; | ||
@@ -151,3 +153,3 @@ | ||
} | ||
}) | ||
@@ -229,3 +231,22 @@ | ||
// or "You have 0 new messages" if the third argument is 0 (note pluralized version) | ||
{{ $t('You have {count} new message ::: You have {count} new messages', {count: 5}, 5) }} | ||
// using the translation directly (as specified in the current readme) | ||
{{ $t('You have {count} new message ::: You have {count} new messages', {count: 5}, 5) }} | ||
// using a key to lookup the translations | ||
{{ $t('mykey', {count: 5}, 5) }} | ||
// in the store | ||
const translations = { | ||
'mykey': 'You have {count} new message ::: You have {count} new messages' | ||
} | ||
// alternative specification with array for translations | ||
const translations = { | ||
'mykey': [ | ||
'You have {count} new message', | ||
'You have {count} new messages' | ||
] | ||
} | ||
</div> | ||
@@ -269,2 +290,5 @@ ``` | ||
// get all available locales | ||
$i18n.locales(), Vue.i18n.locales() | ||
// set the current locale (i.e. 'de', 'en') | ||
@@ -271,0 +295,0 @@ $i18n.set(locale), Vue.i18n.set(locale) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
102935
2017
328