Files
freeplanet/src/globalroutines/util.ts

24 lines
461 B
TypeScript
Raw Normal View History

2019-07-12 14:09:44 +02:00
import { toolsext } from '@src/store/Modules/toolsext'
import messages from '../statics/i18n'
function translate(params) {
const msg = params.split('.')
2019-07-12 14:09:44 +02:00
const lang = toolsext.getLocale()
const stringa = messages[lang]
let ris = stringa
if (!!ris) {
msg.forEach((param) => {
ris = ris[param]
})
} else {
console.log('ERRORE IN TRANSLATE! ', params, ' NON ESISTE!')
return params
}
return ris
}
export default translate