Passed
Push — master ( 61dd3f...482d1b )
by greg
01:51
created

src/cli/cms/templates/handlebars/translate.js   A

Complexity

Total Complexity 5
Complexity/F 5

Size

Lines of Code 10
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
wmc 5
c 1
b 0
f 0
nc 1
mnd 1
bc 2
fnc 1
dl 0
loc 10
rs 10
bpm 2
cpm 5
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
B translate.js ➔ translate 0 8 5
1
import {Locales} from '../../../'
2
3
export default function translate(lang, str) {
4
  var trad = Locales.instance.i18n
5
  if(typeof trad[lang] !== 'undefined' && trad[lang] !== null
6
    && typeof trad[lang][str] !== 'undefined' && trad[lang][str] !== null) {
7
    return trad[lang][str]
8
  }
9
  return str
10
}
11
12