udes-language-mixin

WebJar for udes-language-mixin

License

License

MIT
Categories

Categories

Mixin Application Layer Libs Bytecode Manipulation
GroupId

GroupId

org.webjars.bowergithub.udeselements
ArtifactId

ArtifactId

udes-language-mixin
Last Version

Last Version

2.2.2
Release Date

Release Date

Type

Type

jar
Description

Description

udes-language-mixin
WebJar for udes-language-mixin
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/UdeSElements/udes-language-mixin

Download udes-language-mixin

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bowergithub.udeselements/udes-language-mixin/ -->
<dependency>
    <groupId>org.webjars.bowergithub.udeselements</groupId>
    <artifactId>udes-language-mixin</artifactId>
    <version>2.2.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bowergithub.udeselements/udes-language-mixin/
implementation 'org.webjars.bowergithub.udeselements:udes-language-mixin:2.2.2'
// https://jarcasting.com/artifacts/org.webjars.bowergithub.udeselements/udes-language-mixin/
implementation ("org.webjars.bowergithub.udeselements:udes-language-mixin:2.2.2")
'org.webjars.bowergithub.udeselements:udes-language-mixin:jar:2.2.2'
<dependency org="org.webjars.bowergithub.udeselements" name="udes-language-mixin" rev="2.2.2">
  <artifact name="udes-language-mixin" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bowergithub.udeselements', module='udes-language-mixin', version='2.2.2')
)
libraryDependencies += "org.webjars.bowergithub.udeselements" % "udes-language-mixin" % "2.2.2"
[org.webjars.bowergithub.udeselements/udes-language-mixin "2.2.2"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.bowergithub.polymer : polymer jar [2.0.0,3)

Project Modules

There are no modules declared in this project.

UdeS.LanguageMixin

Published on webcomponents.org Build status

A simple mixin to be aware of the current language application.

The language property is computed from supported languages and from the browser languages.

It implements the observer pattern. You should call the updateLanguage function if you want to update the language of all observers. When the language is changed, the lang attribute of html element is update automatically.

<html lang="en"></html>

The mixin also provide some read-only properties to your component:

  • defaultLanguage: Default language defined globally.
  • language: Current language.
  • navigatorLanguage: Navigator language (see window.navigator.language).
  • navigatorLanguages: Navigator languages (see window.navigator.languages).
  • supportedLanguages: Supported languages defined globally.

Demo

<udes-language-demo></udes-language-demo>

Installation

npm install @udeselements/udes-language-mixin

Usage

To set the default language and the supported languages of your site, add the following code inside your index.html BEFORE you import any HTML component using this mixin.

window.UdeS.Language = {
  defaultLanguage: 'en',
  supportedLanguages: ['en', 'fr'],
};

Localized files with Sherby.LocalizeMixin

If you want also to load some localized files, you should take a look on Sherby.LocalizeMixin instead.

Versions

Version
2.2.2