I want to use a CurrencyValueConverter like the one in the aurelia.io documentation, but localizing the result to Dutch or German, but I don't know how to make all languages available to numeral.
I am able to import the Ducth locale en load it explicitly as follows:
import numeral from 'numeral';
import nl from "numeral/languages/nl-nl";
export class CurrencyValueConverter {
toView(value, language = "nl-nl") {
numeral.language(language, nl); // this line loads the nl language definition
numeral.language(language);
return numeral(value).format("$0,0.00");
}
}
But of course, this only works for one language. How can I load multiple languages while avoiding something like
if(language === "nl-nl")
numeral.language(language, nl);
else if(language === "de-de")
// etc