Locale.AutoUse searches for a lang attribute, which is usually at the html tag of a document. If a language is found and defined by Locale it will set this as default language of the page. You can also choose to get the language of the visitor.
This plugin is an extension for Locale in MooTools More 1.3.
Include the Locale.AutoUse.js file in your page or build.
It is possible to use Locale.AutoUse manually.
Locale.AutoUse(selector, attributeName, ua);
Locale.AutoUse();
// Search for another tag instead of the `html` tag
Locale.AutoUse('div#languageDefinition');
// Don't use the lang attribute, but the `data-lang` attribute
Locale.AutoUse('div[data-lang]', 'data-lang');
// Use the language defined by the visitors browser
Locale.AutoUse(navigator);
// Another way
Locale.AutoUse(null, null, true);
A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.
Found a bug in this plugin? Please report it this repository's Github Issues.
blog comments powered by Disqus