Skip to content

Instantly share code, notes, and snippets.

@caillou
Created December 8, 2011 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save caillou/1446583 to your computer and use it in GitHub Desktop.
Save caillou/1446583 to your computer and use it in GitHub Desktop.
Translation for relativeDate of moment.js
/*jslint white: false */
var langs;
langs = {
"de" : {
today: "heute um %time",
tomorrow: 'morgen um %time',
next: '%weekday um %time',
yesterday: 'gestern um %time',
last: 'letzten %weekday um %time'
},
"en" : {
today: 'Today at %time',
tomorrow: 'Tomorrow at %time',
next: '%weekday at %time', // e.g. Friday at 13:45
yesterday: 'Yesterday at %time',
last: 'last %weekday at %time' // e.g. last Sunday at 13:45
},
"en-GB" : {
today: 'Today at %time',
tomorrow: 'Tomorrow at %time',
next: '%weekday at %time', // e.g. Friday at 13:45
yesterday: 'Yesterday at %time',
last: 'last %weekday at %time' // e.g. last Sunday at 13:45
},
"es" : {
today: function () {
return 'hoy a la' + ((this.hours() !== 1) ? 's' : '') + ' %time';
},
tomorrow: function () {
return 'mañana a la' + ((this.hours() !== 1) ? 's' : '') + ' %time';
},
next: function () {
return '%weekday a la' + ((this.hours() !== 1) ? 's' : '') + ' %time';
},
yesterday: function () {
return 'ayer a la' + ((this.hours() !== 1) ? 's' : '') + ' %time';
},
last: function () {
return 'el %weekday pasado a la' + ((this.hours() !== 1) ? 's' : '') + ' %time';
}
},
"fr" : {
today: "ajourd'hui à %time",
tomorrow: 'demain à %time',
next: '%weekday à %time',
yesterday: 'hier à %time',
last: '%weekday denier à %time'
},
"it" : {
today: 'Oggi alle %time',
tomorrow: 'Domani alle %time',
next: '%weekday alle %time',
yesterday: 'Ieri alle %time',
last: 'lo scorso %weekday alle %time'
},
"kr" : {
today: '오늘 %time',
tomorrow: '내일 %time',
next: '%weekday %time',
yesterday: '어제 %time',
last: '지난주 %weekday %time'
},
"nb" : {
today: 'I dag klokken %time',
tomorrow: 'I morgen klokken %time',
next: '%weekday klokken %time',
yesterday: 'I går klokken %time',
last: 'Forrige %weekday klokken %time'
},
"nl" : {
today: 'Vandaag om %time',
tomorrow: 'Morgen om %time',
next: '%weekday om %time', // e.g. Friday at 13:45
yesterday: 'Gisteren om %time',
last: 'afgelopen %weekday om %time' // e.g. last Sunday at 13:45
},
"pl" : {
today: 'Dziś o %time',
tomorrow: 'Jutro o %time',
next: 'W %weekday o %time', // e.g. Friday at 13:45
yesterday: 'Wczoraj o %time',
last: 'W zeszły/łą %weekday o %time' // e.g. last Sunday at 13:45
},
"pt" : {
today: 'Hoje às %time',
tomorrow: 'Amanhã às %time',
next: '%weekday às %time',
yesterday: 'Ontem às %time',
last: function () {
var weekday = parseInt(this.format('d'), 10);
if (weekday < 5) {
// Mo - Fr
return 'Última %weekday às %time';
} else {
// Sa + Su
return 'Último %weekday às %time';
}
}
},
"ru" : {
today: 'Сегодня в %time',
tomorrow: 'Завтра в %time',
next: function () {
var nextArray, weekday;
weekday = parseInt(this.format('d'), 10);
nextArray = [
'В понедельник в %time',
'Во вторник в %time',
'В среду в %time',
'В четверг в %time',
'В пятницу в %time',
'В субботу в %time',
'В воскресенье в %time'
];
return nextArray[weekday];
},
yesterday: 'Вчера в %time',
last: function () {
var lastArray, weekday;
weekday = parseInt(this.format('d'), 10);
lastArray = [
'В прошлый понедельник в %time',
'В прошлый вторник в %time',
'В прошлую среду в %time',
'В прошлый четверг в %time',
'В прошлую пятницу в %time',
'В прошлую субботу в %time',
'В прошлое воскресенье в %time'
];
return lastArray[weekday];
}
},
"sv" : {
today: 'Idag klockan %time',
tomorrow: 'Imorgon klockan %time',
next: '%weekday klockan %time',
yesterday: 'Igår klockan %time',
last: 'Förra %weekdayen klockan %time'
}
};
@caillou
Copy link
Author

caillou commented Dec 8, 2011

@robnyman: is the postfix 'en' for every day? Then I could just do the following:

last: 'Förra {%weekday}en klockan %time'

@robnyman
Copy link

robnyman commented Dec 8, 2011

Yes, that should work fine!

@CaptSpot
Copy link

Dutch:

"nl" : {
today: 'vandaag om %time',
tomorrow: 'morgen om %time',
next: '%weekday om %time',
yesterday: 'gisteren om %time',
last: 'verleden %weekday om %time'
},

@marijn
Copy link

marijn commented Dec 11, 2011

I added the dutch translation in this fork.

Update I didn't see the comment by @spotbot. Though I'd prefer afgelopen in favor of verleden but that's just personal taste :-)

@caillou
Copy link
Author

caillou commented Dec 11, 2011

Thanks @marijn and @spotbot for your translations! I merged @marijn's translation in...

@ruanmer
Copy link

ruanmer commented Dec 12, 2011

"pt" : {
today: 'Hoje às %time',
tomorrow: 'Amanhã às %time',
next: '%weekday às %time',
yesterday: 'Ontem às %time',
last: 'Último(a) %weekday às %time'
},

@caillou
Copy link
Author

caillou commented Dec 12, 2011

Thx @ruanmer ... Portuguese is pushed!

@mrbase
Copy link

mrbase commented Dec 13, 2011

just added danish translation in fork

@caillou
Copy link
Author

caillou commented Dec 13, 2011

@mrbase: I'd love to integrate it… But this is just an addition to an existing framework. So you'd need to add danish here first: https://github.com/timrwood/moment/tree/master/lang

@mrbase
Copy link

mrbase commented Dec 13, 2011

fair @caillou, just added a pull request to moment with the danish translation

@kyungw00k
Copy link

 "kr" : {
        today: function(){ return this.format('오늘 a h:mm') },
        tomorrow: function(){ return this.format('내일 a h:mm') },
        next: function(){ return this.format('dddd a h:mm') },
        yesterday: function(){ return this.format('어제 a h:mm') },
        last: function(){ return this.format('지난주 dddd a h:mm') }
    },

I'm not sure, but it could possibly work.

@mrbase
Copy link

mrbase commented Dec 15, 2011

danish now added to moment

@diamantsallahu
Copy link

Albanian

"sq" : {
today: 'Sot në %time',
tomorrow: 'Nesër në %time',
next: '%weekday në %time',
yesterday: 'Dje në %time',
last: 'e kaluar %weekday në %time'
},

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