Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vuex-i18n

Package Overview
Dependencies
Maintainers
3
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vuex-i18n - npm Package Compare versions

Comparing version 1.3.2 to 1.3.3

5

dist/vuex-i18n.cjs.js

@@ -381,2 +381,7 @@ 'use strict';

// use singular version for -1 as well
if (pluralization === -1) {
return translatedText[0].trim();
}
if (translatedText.length > 1) {

@@ -383,0 +388,0 @@ return translatedText[1].trim();

@@ -379,2 +379,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {

// use singular version for -1 as well
if (pluralization === -1) {
return translatedText[0].trim();
}
if (translatedText.length > 1) {

@@ -381,0 +386,0 @@ return translatedText[1].trim();

@@ -385,2 +385,7 @@ (function (global, factory) {

// use singular version for -1 as well
if (pluralization === -1) {
return translatedText[0].trim();
}
if (translatedText.length > 1) {

@@ -387,0 +392,0 @@ return translatedText[1].trim();

2

package.json
{
"name": "vuex-i18n",
"version": "1.3.2",
"version": "1.3.3",
"description": "Easy localization for vue-components using vuex as data store",

@@ -5,0 +5,0 @@ "directories": {

@@ -98,3 +98,3 @@ # vuex-i18n

## Usage
The plugin provides easy access to localized information through the use of
vuex-i18n provides easy access to localized information through the use of
the `$t()` method or the `translate` filter.

@@ -104,5 +104,10 @@

currently defined locale and return the respective translation. If the string
is not found, it will return as is. This allows to setup an application very
quickly without having to first define all strings in a separate template.
is not found, it will return as is. This wil allow you to setup an application
very quickly without having to first define all strings in a separate template.
It is also possible to specify a fallback-locale `$i18n.fallback(locale)`. If
the key is not found in current locale, vuex-i18n will look for the key in the
fallback-locale. If the key can not be found in the fallback-locale either,
the key itself will be returned as translation.
```javascript

@@ -116,4 +121,4 @@ <div>

The `$t()` method also allows for inclusion of dynamic parameters that can be
passed to the method in the form of key/value pairs
Dynamic parameters that can be passed to the translation method in the form of
key/value pairs.

@@ -123,17 +128,24 @@ ```javascript

// will return: "You have 5 new messages"
{{ $t('You have {number} new messages', {number: 5}) }}
{{ $t('You have {count} new messages', {count: 5}) }}
</div>
```
The `$t()` method support basic pluralization
Basic pluralization is also supported. Please note, that the singular translation
must be specified first, denoted from the pluralized translation by `:::`.
The third parameter is used to define if the singular or plural version should be
used (see below for examples). Dynamic parameters can be passed as second argument.
```javascript
<div>
// will return: "You have 5 new messages" or "You have one new message" if number passed is 1
{{ $t('You have one new message ::: You have {number} new messages', {number: 5}, 5) }}
// will return: "You have 5 new messages" if the third argument is 5"
// or "You have 1 new message" if the third argument is 1
// or "You have -1 new message" if the third argument is -1
// 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) }}
</div>
```
If you want to fetch a translation for a specific language, whats currently not
the locale use the `$tlang()` method.
The current locale can be set using the `$i18n.set()` method. By default, the
translation method will select the pre-specified current locale. However, it is
possible to request a specific locale using the `$tlang()` method.

@@ -143,3 +155,3 @@ ```javascript

// will return the english translation regardless of the current locale
{{ $tlang('en', 'You have {number} new messages', {number: 5}) }}
{{ $tlang('en', 'You have {count} new messages', {count: 5}) }}
</div>

@@ -146,0 +158,0 @@ ```

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