0.1.0 • Published 6 years ago

leajs-locale v0.1.0

Weekly downloads
103
License
MIT
Repository
github
Last release
6 years ago

leajs-locale

Plugin of leajs.

Simplifies handling locale header.

leajs.config

module.exports = {

  // …

  // Locale options, can be used as a shortcut for 'locale.available'
  locale: null, // [Object, Array]

  // Available languages, first languages is fallback
  locale.available: null, // Array

  // Query property to overwrite browser language
  locale.query: null, // String

  // Position in url to look for used language
  locale.url: null, // Number

  // …

}

Example

module.exports = {

  // …

  locale: {
    available: ["en","de"],
    query: "lang", // will allow ?lang=en
    url: "1" // will parse /de/someurl
  }
  
  // …

}

License

Copyright (c) 2018 Paul Pflugradt Licensed under the MIT license.