First Committ
This commit is contained in:
25
src/globalroutines/util.ts
Executable file
25
src/globalroutines/util.ts
Executable file
@@ -0,0 +1,25 @@
|
||||
import { toolsext } from '@src/store/Modules/toolsext'
|
||||
import { tools } from '@src/store/Modules/tools'
|
||||
import messages from '../statics/i18n'
|
||||
|
||||
function translate(params: any) {
|
||||
const msg = params.split('.')
|
||||
const lang = toolsext.getLocale()
|
||||
|
||||
// @ts-ignore
|
||||
const stringa = messages[lang]
|
||||
|
||||
let ris = stringa
|
||||
if (ris) {
|
||||
msg.forEach((param: any) => {
|
||||
ris = ris[param]
|
||||
})
|
||||
} else {
|
||||
console.log('ERRORE IN TRANSLATE! ', params, ' NON ESISTE!')
|
||||
return params
|
||||
}
|
||||
|
||||
return ris
|
||||
}
|
||||
|
||||
export default translate
|
||||
Reference in New Issue
Block a user