forked from lopezs/ableplayer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtranslation1.js
More file actions
42 lines (36 loc) · 1.41 KB
/
translation1.js
File metadata and controls
42 lines (36 loc) · 1.41 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(function ($) {
AblePlayer.prototype.getSupportedLangs = function() {
// returns an array of languages for which AblePlayer has translation tables
var langs = ['en','de','es','nl'];
return langs;
};
AblePlayer.prototype.getTranslationText = function() {
// determine language, then get labels and prompts from corresponding translation var
var gettingText, lang, thisObj, msg;
gettingText = $.Deferred();
// override this.lang to language of the web page, if known and supported
// otherwise this.lang will continue using default
if (!this.forceLang) {
if ($('body').attr('lang')) {
lang = $('body').attr('lang');
}
else if ($('html').attr('lang')) {
lang = $('html').attr('lang');
}
if (lang !== this.lang) {
msg = 'Language of web page (' + lang +') ';
if ($.inArray(lang,this.getSupportedLangs()) !== -1) {
// this is a supported lang
msg += ' has a translation table available.';
this.lang = lang;
}
else {
msg += ' is not currently supported. Using default language (' + this.lang + ')';
}
if (this.debug) {
console.log(msg);
}
}
}
// in final build, all language variables are contatenated into this function below...
// translation2.js is then contanenated onto the end to finish this function