blob: d20760377ff4aed7c68b2cd8e9ceca43ddee838b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
/**
* Helper object to access manifest information with locale support.
*/
var ManifestHelper = function(manifest) {
var localeRoot = manifest;
var locales = manifest.locales;
if (locales) {
var lang = document.documentElement.lang;
// If there is a manifest entry for the curret locale, use it, otherwise
// fallback on the default manifest.
localeRoot = locales[lang] || locales[lang.split('-')[0]] || manifest;
}
// Bind the localized property values.
for (var prop in manifest) {
this[prop] = localeRoot[prop] || manifest[prop];
}
};
|