Open Noitidart opened 6 years ago
Moment itself stores locales within its repository, and there are instructions in the moment docs on how to build with specific locales, all locales, etc. https://github.com/moment/moment/tree/develop/locale
It hadn't occurred to me to add a folder of duration-format locale extensions to this plugin's repository, but it's a pretty nice idea. It would make localization that much more straightforward.
Thank you very much sir!!
should we close this?
for reference, I got it working adding this:
moment.updateLocale('nl', {
durationLabelsStandard: {
S: 'milliseconde',
SS: 'milliseconden',
s: 'seconde',
ss: 'seconden',
m: 'minuut',
mm: 'minuten',
h: 'uur',
hh: 'uur',
d: 'dag',
dd: 'dagen',
w: 'week',
ww: 'weken',
M: 'maand',
MM: 'maanden',
y: 'jaar',
yy: 'jaar'
},
durationLabelsShort: {
S: 'msec',
SS: 'msec',
s: 'sec',
ss: 'sec',
m: 'min',
mm: 'min',
h: 'uur',
hh: 'uur',
d: 'dag',
dd: 'dgn',
w: 'wk',
ww: 'wkn',
M: 'mnd',
MM: 'mnd',
y: 'jr',
yy: 'jr'
},
relativeTime : {
future : 'over %s',
past : '%s',
s : "zojuist",
m : 'één minuut',
mm : '%d minuten',
h : 'één uur',
hh : '%d uur',
d : "gisteren",
dd : '%d dagen',
M : "vorige maand",
MM : '%d maanden',
y : "vorig jaar",
yy : '%d jaar'
},
durationTimeTemplates: {
HMS: 'h:mm:ss',
HM: 'h:mm',
MS: 'm:ss'
},
durationLabelTypes: [
{ type: "standard", string: "__" },
{ type: "short", string: "_" }
],
durationPluralKey: function (token: string, integerValue: number, decimalValue: number) {
// Singular for a value of `1`, but not for `1.0`.
if (integerValue === 1 && decimalValue === null) {
return token;
}
return token + token;
}
});
Is there anywhere that all the locale packages are listed/available for us? That would be real awesome to have a shared repo or something of that.
Btw does regular moment have a repo of their locales?