MCPcopy Create free account
hub / github.com/codecombat/codecombat / checkLang

Function checkLang

scripts/check-long-i18n.js:4–26  ·  view source on GitHub ↗
(lang)

Source from the content-addressed store, hash-verified

2const locale = require('../app/locale/locale')
3
4function checkLang (lang) {
5 if (lang === 'en') {
6 return
7 }
8 const language = require(`../app/locale/${lang}.js`).translation
9 Object.keys(en).forEach(key => {
10 if (!language[key]) {
11 // console.log(`Missing key: ${key}`)
12 return
13 }
14 Object.keys(en[key]).forEach(subKey => {
15 if (!language[key][subKey]) {
16 // console.log(`Missing key: ${key}.${subKey}`)
17 return
18 }
19 const enLength = en[key][subKey].length
20 const langLength = language[key][subKey].replace('[AI_TRANSLATION]', '').length
21 if (langLength - enLength > 20 && langLength > enLength * 2) {
22 console.log(`${lang} Too long: ${key}.${subKey} - ${langLength} vs ${enLength}`)
23 }
24 })
25 })
26}
27
28function main () {
29 Object.keys(locale).forEach(lang => {

Callers 1

mainFunction · 0.85

Calls 1

logMethod · 0.80

Tested by

no test coverage detected