Skip to content

Instantly share code, notes, and snippets.

@crisu83
Last active August 24, 2018 13:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save crisu83/904d23d9357d60c82bd4 to your computer and use it in GitHub Desktop.
Save crisu83/904d23d9357d60c82bd4 to your computer and use it in GitHub Desktop.
Finnish translation for Moment.js
//! moment.js locale configuration
//! locale : finnish (fi)
//! author : Tarmo Aidantausta : https://github.com/bleadof
//! author : Christoffer Niska : https://github.com/crisu83
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('../moment')) :
typeof define === 'function' && define.amd ? define(['moment'], factory) :
factory(global.moment)
}(this, function (moment) { 'use strict';
function processRelativeTime(number, withoutSuffix, key, isFuture) {
var format = {
'm': ['minuutti', 'minuutin'],
'mm': [number + ' minuuttia', number + ' minuutin'],
'h': ['tunti', 'tunnin'],
'hh': [number + ' tuntia', number + ' tunnin'],
'd': ['päivä', 'päivän'],
'dd': [number + ' päivää', number + ' päivän'],
'M': ['kuukausi', 'kuukauden'],
'MM': [number + ' kuukautta', number + ' kuukauden'],
'y': ['vuosi', 'vuoden'],
'yy': [number + ' vuotta', number + ' vuoden']
};
return !isFuture ? format[key][0] : format[key][1];
}
var fi = moment.defineLocale('fi', {
months : 'tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu'.split('_'),
monthsShort : 'tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu'.split('_'),
weekdays : 'sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai'.split('_'),
weekdaysShort : 'su_ma_ti_ke_to_pe_la'.split('_'),
weekdaysMin : 'su_ma_ti_ke_to_pe_la'.split('_'),
longDateFormat : {
LT : 'HH.mm',
LTS : 'HH.mm.ss',
L : 'DD.MM.YYYY',
LL : 'Do MMMM[ta] YYYY',
LLL : 'Do MMMM[ta] YYYY, [klo] LT',
LLLL : 'dddd, Do MMMM[ta] YYYY, [klo] LT',
l : 'D.M.YYYY',
ll : 'Do MMM YYYY',
lll : 'Do MMM YYYY, [klo] LT',
llll : 'ddd, Do MMM YYYY, [klo] LT'
},
calendar : {
sameDay : '[tänään] [klo] LT',
nextDay : '[huomenna] [klo] LT',
nextWeek : 'dddd [klo] LT',
lastDay : '[eilen] [klo] LT',
lastWeek : '[viime] dddd[na] [klo] LT',
sameElse : 'L'
},
relativeTime : {
future : '%s päästä',
past : '%s sitten',
s : 'hetki',
m : processRelativeTime,
mm : processRelativeTime,
h : processRelativeTime,
hh : processRelativeTime,
d : processRelativeTime,
dd : processRelativeTime,
M : processRelativeTime,
MM : processRelativeTime,
y : processRelativeTime,
yy : processRelativeTime
},
ordinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return fi;
}));
@crisu83
Copy link
Author

crisu83 commented Jun 20, 2015

I modified the translation originally made by @bleadof to be more similar to the other translations for Moment.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment