axe-locales
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

axe-locales

axe locale selector

Setup

npm install -D axe-locales
# or
yarn add -D axe-locales

Useage

If you set a language that does not exist, an empty object will be returned.

// require module
const {axeLocale, getLocaleList} = require('axe-locales');

// locale selector
const locale = axeLocale("ja");   // Fix Language
const locale = axeLocale("auto"); // Auto Select(from browser setting)
const locale = axeLocale("zombie"); // ->  {}

// get locale list
const list = getLocaleList(); // -> ["da", "de", "es", "eu", "fr", "ja", "ko", "nl", "pl", "pt_BR"]

Register Axe plugins.

import Vue from 'vue'
import { axeLocale } from 'axe-locales'

const reportLang = "auto";
const axeConfig = { config:{} };

if (process.env.NODE_ENV === 'development') {
  const locale = axeLocale(reportLang);
  const VueAxe = require('vue-axe').default

  // Be careful not to overwrite the locale if the language does not exist
  if(Object.keys(locale).length){
    Object.assign(axeConfig, {
      config: {
        "locale": locale
      }
    });
  }
  Vue.use(VueAxe, axeConfig);
}

Readme

Keywords

Package Sidebar

Install

npm i axe-locales

Weekly Downloads

5

Version

0.2.0

License

MIT

Unpacked Size

14.8 kB

Total Files

14

Last publish

Collaborators

  • shunito