alp-language

1.9.1 • Public • Published

alp-language

language context in alp framework

Config file

common:
    availableLanguages: [en, fr]

With Koa

import Koa from 'koa';
import config from 'alp-config';
import language from 'alp-language';
 
const app = new Koa();
config(__dirname + '/config')(app);
language(app);

With Ibex (Browser)

import Ibex from 'ibex';
import config from 'alp-config';
import language from 'alp-language';
 
const app = new Ibex();
config('/config')(app);
language(app);

context

language: string

First accepted language in the header / in navigator.languages contained in availableLanguages, or the first language in availableLanguages.

firstAcceptedLanguage: string

The first accepted language in the header / in navigator.languages regardless of availableLanguages. Can be a locale. Usefull for date/time/...

/alp-language/

    Package Sidebar

    Install

    npm i alp-language

    Weekly Downloads

    1

    Version

    1.9.1

    License

    ISC

    Unpacked Size

    218 kB

    Total Files

    33

    Last publish

    Collaborators

    • churpeau