Skip to content

Instantly share code, notes, and snippets.

@pyetras
Forked from rmm5t/README.md
Created June 19, 2009 22:10
Show Gist options
  • Save pyetras/132916 to your computer and use it in GitHub Desktop.
Save pyetras/132916 to your computer and use it in GitHub Desktop.
You can represent time statements in most western languages where
a prefix and/or suffix is used.
The default case is to use suffix only (as in English), which you
do by providing the `suffixAgo` and `suffixFromNow` settings in
the strings hash (earlier versions of timeago used the deprecated
`ago` and `fromNow` options). If present, they are used.
2 minutes [suffixAgo]
2 minutes [suffixFromNow]
In case you want to use prefix only instead of
suffix (e.g. Greek), you provide the `prefixAgo` and
`prefixFromNow` options in the strings hash and leave `suffixAgo`
and `suffixFromNow` empty or null.
[prefixAgo] 2 minutes
[prefixFromNow] 2 minutes
For languages where you want to use a prefix only for future
tense and prefix/suffix for past tense (for example swedish), you
can combine the prefix and suffixes as needed.
[prefixAgo] 2 minutes [suffixAgo]
[prefixFromNow] 2 minutes
// Greek
jQuery.timeago.settings.strings = {
prefixAgo: "πριν",
prefixFromNow: "σε",
suffixAgo: "",
suffixFromNow: "",
seconds: "λιγότερο από ένα λεπτό",
minute: "περίπου ένα λεπτό",
minutes: "%d λεπτά",
hour: "περίπου μία ώρα",
hours: "περίπου %d ώρες",
day: "μία μέρα",
days: "%d μέρες",
month: "περίπου ένα μήνα",
months: "%d μήνες",
year: "περίπου ένα χρόνο",
years: "%d χρόνια"
};
// Spanish
jQuery.timeago.settings.strings = {
suffixAgo: "apenas un momento atrás",
suffixFromNow: "a partir de ahora",
seconds: "menos de um minuto",
minute: "cerca de um minuto atrás",
minutes: "hace unos %d minutos atrás",
hour: "cerca de una hora",
hours: "cerca de %d horas",
day: "un día",
days: "%d días",
month: "hace un mes atrás",
months: "hace %d meses",
year: "hace un año atrás",
years: "hace %d años atrás"
};
// French
jQuery.timeago.settings.strings = {
// environ ~= about, it's optional
prefixAgo: "il y a",
prefixFromNow: "d'ici",
seconds: "moins d'une minute",
minute: "environ une minute",
minutes: "environ %d minutes",
hour: "environ une heure",
hours: "environ %d heures",
day: "environ un jour",
days: "environ %d jours",
month: "environ un mois",
months: "environ %d mois",
year: "un an",
years: "%d ans"
};
// Hungarian
jQuery.timeago.settings.strings = {
prefixAgo: null,
prefixFromNow: null,
suffixAgo: null,
suffixFromNow: null,
seconds: "kevesebb mint egy perce",
minute: "körülbelül egy perce",
minutes: "%d perce",
hour: "körülbelül egy órája",
hours: "körülbelül %d órája",
day: "körülbelül egy napja",
days: "%d napja",
month: "körülbelül egy hónapja",
months: "%d hónapja",
year: "körülbelül egy éve",
years: "%d éve"
};
// Dutch
jQuery.timeago.settings.strings = {
suffixAgo: "geleden",
suffixFromNow: "vanaf nu",
seconds: "iets minder dan een minute",
minute: "ongeveer een minuut",
minutes: "%d minuten",
hour: "ongeveer een uur",
hours: "ongeveer %d uren",
day: "een dag",
days: "%d dagen",
month: "ongeveer een maand",
months: "%d maanden",
year: "ongeveer een jaar",
years: "%d jaar"
};
//Polish
function numpf(n, f, s) {
if ( n < 5 ) {
return f;
} else {
return s;
}
}
jQuery.timeago.settings.strings = {
prefixAgo: null,
prefixFromNow: null,
suffixAgo: "temu",
suffixFromNow: "od teraz",
ago: null, // DEPRECATED, use suffixAgo
fromNow: null, // DEPRECATED, use suffixFromNow
seconds: "niecała minutę",
minute: "mniej więcej minutę",
minutes: "%d min",
hour: "mniej więcej godzinę",
hours: "mniej więcej %d h",
day: "jeden dzień",
days: "%d dni",
month: "mniej więcej miesiąc",
months: "%d mies",
year: "mniej więcej rok",
years: function(value) { return numpf(value, "%d lata", "%d lat"); }
}
// Portuguese
jQuery.timeago.settings.strings = {
suffixAgo: "atrás",
suffixFromNow: "a partir de agora",
seconds: "menos de um minuto",
minute: "cerca de um minuto",
minutes: "%d minutos",
hour: "cerca de uma hora",
hours: "cerca de %d horas",
day: "um dia",
days: "%d dias",
month: "cerca de um mês",
months: "%d meses",
year: "cerca de um ano",
years: "%d anos"
};
// Russian
(function() {
function numpf(n, f, s, t) {
// f - 1, 21, 31, ...
// s - 2-4, 22-24, 32-34 ...
// t - 5-20, 25-30, ...
var n10 = n % 10;
if ( (n10 == 1) && ( (n == 1) || (n > 20) ) ) {
return f;
} else if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) {
return s;
} else {
return t;
}
}
jQuery.timeago.settings.strings = {
prefixAgo: null,
prefixFromNow: "через",
suffixAgo: "назад",
suffixFromNow: null,
seconds: "меньше минуты",
minute: "минуту",
minutes: function(value) { return numpf(value, "%d минута", "%d минуты", "%d минут"); },
hour: "час",
hours: function(value) { return numpf(value, "%d час", "%d часа", "%d часов"); },
day: "день",
days: function(value) { return numpf(value, "%d день", "%d дня", "%d дней"); },
month: "месяц",
months: function(value) { return numpf(value, "%d месяц", "%d месяца", "%d месяцев"); },
year: "год",
years: function(value) { return numpf(value, "%d год", "%d года", "%d лет"); }
};
})();
// Swedish
jQuery.timeago.settings.strings = {
prefixAgo: "för",
prefixFromNow: "om",
suffixAgo: "sedan",
suffixFromNow: "",
seconds: "mindre än en minut",
minute: "ungefär en minut",
minutes: "%d minuter",
hour: "ungefär en timme",
hours: "ungefär %d timmar",
day: "en dag",
days: "%d dagar",
month: "ungefär en månad",
months: "%d månader",
year: "ungefär ett år",
years: "%d år"
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment