-
Notifications
You must be signed in to change notification settings - Fork 159
Closed
Labels
Description
Problem
locale es-MX gets en formatted functions
Demonstration
tiny runnable demo here: https://github.com/cdaringe/multi-locale-invalid-dates
it can be seen in just this code too:
const MessageFormat = require("@messageformat/core");
const compileMessageModule = require("@messageformat/core/lib/compile-module");
const messagePacks = {
"en-US": {
utilsDate: "{date, date, ::EEEMMMd}",
utilsToday: "today",
utilsTomorrow: "tomorrow",
},
"es-MX": {
utilsDate: "{date, date, ::MMMMd}",
utilsToday: "hoy",
utilsTomorrow: "mañana",
},
};
const mf = new MessageFormat("*");
console.log(compileMessageModule(mf, messagePacks));which emits:
const date_en_MMMMd_meky2n = (function() { // should be es_mx
var opt = {"month":"long","day":"numeric"}; // need to research if this is correct or not
var dtf = new Intl.DateTimeFormat("en", opt); // should be "es-MX"
return function(value) { return dtf.format(value); }
})();
export default {
"en-US": {/* snip */},
"es-MX": {
utilsDate: (d) => date_en_MMMMd_meky2n(d.date),
utilsToday: () => "hoy",
utilsTomorrow: () => "mañana"
}
}Reactions are currently unavailable