js/lib/API/i18n.js   A
last analyzed

Complexity

Total Complexity 8
Complexity/F 1.33

Size

Lines of Code 29
Function Count 6

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 0
c 0
b 0
f 0
nc 1
dl 0
loc 29
rs 10
wmc 8
mnd 1
bc 10
fnc 6
bpm 1.6666
cpm 1.3333
noi 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A API.i18n.getAcceptLanguages 0 12 2
A API.i18n.detectLanguage 0 12 2
1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
7
8
/* global API */
9
API.i18n = {
10
    getAcceptLanguages: function() {
11
        if (API.promise) {
12
            return API.api.i18n.getAcceptLanguages();
13
        }
14
        else {
15
            return new C_Promise(function(){
16
                API.extension.getAcceptLanguages((function(data){
17
                    this.call_then(data);
18
                }).bind(this));
19
            });
20
        }
21
    },
22
    detectLanguage: function() {
23
        if (API.promise) {
24
            return API.api.i18n.detectLanguage();
25
        }
26
        else {
27
            return new C_Promise(function(){
28
                API.api.i18n.detectLanguage((function(isReliable, languages){
29
                    this.call_then(isReliable, languages);
30
                }).bind(this));
31
            });
32
        }
33
    },
34
    getMessage: API.api.i18n.getMessage,
35
    getUILanguage: API.api.i18n.getUILanguage
36
37
};