npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@garage11/vue-i18n

v1.1.0

Published

Easy localization for vue-components using vue-stash as data store

Readme

vue-i18n

This is a fork of the awesome vuex-i18n i18n plugin for Vue. It reuses the same i18n functionality but has vue-stash as a store backend.

Requirements

  • Vue 2
  • Vue-stash 2

Installation

$ npm install @garage11/vue-i18n

Setup

The vue-i18n-stash plugin is intended to be used for applications that use Vue-stash as store and require localized messages. Make sure that both Vue and Vue-stash have been loaded beforehand.

The plugin does not make any assumption on how you want to load the localization information. It can be loaded on start in your application bundle or dynamically after when the user is switching to a different language.

Usage

The plugin provides easy access to localized information through the use of the $t() method or the translate filter.

It will try to find the given string as key in the translations of the currently defined locale and return the respective translation. If the string 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, vue-i18n-stash 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.

<div>
	// will return: "Some localized information"
	{{ $t('Some localized information')}}
</div>

Dynamic parameters that can be passed to the translation method in the form of key/value pairs.

<div>
	// will return: "You have 5 new messages"
	{{ $t('You have {count} new messages', {count: 5}) }}
</div>

It is possible to specify custom identifiers for variable substitutions. The respective identifiers - start and stop - must be passed when initializing the module. Please note that a regular expression is used to match the tags. Therefore it might be necessary to escape certain characters accordingly.

// i.e. to use {{count}} as variable substitution.
// the third parameter defines the module name and is i18n per default
Vue.use(vueI18nStash.plugin, store, 'i18n', ['{{','}}']);

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.

<div>
	// 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>

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.

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

There are also several methods available on the property this.$i18n or Vue.i18n

$i18n.locale(), Vue.i18n.locale()
	// get the current locale

$i18n.set(locale), Vue.i18n.set(locale)
	// set the current locale (i.e. 'de', 'en')

$i18n.add(locale, translations), Vue.i18n.add(locale, translations)
	// add a new locale to the storage
	// (i.e. 'de', {'message': 'Eine Nachricht'})

$i18n.localeExists(locale), Vue.i18n.localeExists(locale)
	// check if the given locale translations are present in the store

$i18n.keyExists(key), Vue.i18n.keyExists(key)
	// check if the given key is available in the current or fallback locale

$i18n.remove(locale), Vue.i18n.remove(locale)
	// remove the given locale from the store

$i18n.fallback(locale), Vue.i18n.fallback(locale)
	// set a fallback locale if translation for current locale does not exist

Contributions

Any comments or suggestions are very welcome.