Created
July 10, 2020 13:15
-
-
Save Lunberg88/563ab8539cec4aab1bbddf5b64cfc5f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numeral from 'numeral'; | |
import 'numeral/locales/de'; | |
import 'numeral/locales/de-ch'; | |
import 'numeral/locales/it'; | |
import 'numeral/locales/fr'; | |
numeral.locale('de-ch'); | |
Vue.prototype.$numeral = (val) => { | |
let locale = i18n.locale; | |
let filteredLang = languages.filter(lang => lang.name === locale); | |
let selectedLang = 'de-ch'; | |
if (filteredLang.length > 0) { | |
selectedLang = filteredLang[0].languageCode.toLowerCase(); | |
} | |
numeral.locale(selectedLang); | |
return numeral(val).format(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment