Skip to content

Instantly share code, notes, and snippets.

@Lunberg88
Created July 10, 2020 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lunberg88/563ab8539cec4aab1bbddf5b64cfc5f0 to your computer and use it in GitHub Desktop.
Save Lunberg88/563ab8539cec4aab1bbddf5b64cfc5f0 to your computer and use it in GitHub Desktop.
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