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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@undecaf/vue-material-locales

v0.2.2

Published

Locales for the Vue Material datepicker

Downloads

19

Readme

Locales for the Vue Material datepicker

Minified size Open issues Vulnerabilities Total downloads License

This package provides ~75 locales for the Vue Material datepicker, i.e. day and month names, date formats and button text (all the properties that are required for Vue.material.locale).

All locales combined comprise about 50 kB, ~700 bytes/locale. Locales can be installed individually or all together.

A simple online example is available here (example source code).

Installation as ES6 modules

$ npm install @undecaf/vue-material-locales
    or
$ yarn add @undecaf/vue-material-locales

Registering individual locales:

import VueMaterialLocales from '@undecaf/vue-material-locales'
import en from '@undecaf/vue-material-locales/dist/locale/en-US'
import de from '@undecaf/vue-material-locales/dist/locale/de'
    ...
// This must come after Vue.use(VueMaterial):
Vue.use(VueMaterialLocales, [ en, de ])

Registering all available locales:

import VueMaterialLocales from '@undecaf/vue-material-locales'
import locales from '@undecaf/vue-material-locales/dist/locale'
    ...
// This must come after Vue.use(VueMaterial):
Vue.use(VueMaterialLocales, locales)

Installation as <script>

Registering individual locales:

<!-- After the Vue and Vue Material scripts -->
<script src="https://cdn.jsdelivr.net/npm/@undecaf/vue-material-locales/dist/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@undecaf/vue-material-locales/dist/locale/en-US/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@undecaf/vue-material-locales/dist/locale/de/index.js"></script>

Registering all available locales:

<!-- After the Vue and Vue Material scripts -->
<script src="https://cdn.jsdelivr.net/npm/@undecaf/vue-material-locales/dist/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@undecaf/vue-material-locales/dist/locale/index.js"></script>

Selecting a locale

// Assuming that 'en-US' and 'de' have been registered
vm.$material.selectLocale('de')
vm.$material.selectLocale('en-US')

selectLocale() returns the language tag that was actually selected, or undefined if no suitable locale could be found.

Language tags are treated case-insensitively, and both '-' and '_' are valid subtag separators.

If the requested locale is not available, a more specific locale is considered first, and then a more general one. The search is carried out in registration order:

// Assuming that 'en-US' and 'de' have been registered
vm.$material.selectLocale('de-DE')  // -> 'de', locale set
vm.$material.selectLocale('en')     // -> 'en-US', locale set
vm.$material.selectLocale('en-AU')  // searches 'en-AU', then 'en' -> 'en-US', locale set
vm.$material.selectLocale('it')     // -> undefined, locale unchanged

Fallback locales can be given as additional arguments:

// Assuming that 'en-US' and 'de' have been registered
vm.$material.selectLocale('de-AT', 'en')  // -> 'de', locale set
vm.$material.selectLocale('it', 'de-DE')  // -> 'de', locale set
vm.$material.selectLocale('it', 'en')     // -> 'en-US', locale set
vm.$material.selectLocale('jp', 'it')     // -> undefined, locale unchanged

List of registered locales

Object vm.$material.locales contains registered locales by language tag:

{
    de:      { tag: 'de',    /* ... Vue.material.locale properties for German     */ },
    'en-US': { tag: 'en-US', /* ... Vue.material.locale properties for US English */ },
    ...
}

Credits

Date/time formats are based on the locales of the marvelous date-fns!

License

Software: MIT

Documentation: CC-BY-SA 4.0