Added translation for dates

This commit is contained in:
Pierre HUBERT 2018-08-05 16:40:14 +02:00
parent 0af31052b4
commit 2cd9338417
4 changed files with 23 additions and 11 deletions

View File

@ -27,7 +27,7 @@ ComunicWeb.common.date = {
//Check there was less than one minute //Check there was less than one minute
if(difference == 0) if(difference == 0)
return seconds + "s"; return lang("dates_s", [seconds]);
//Calculate minutes //Calculate minutes
@ -36,7 +36,7 @@ ComunicWeb.common.date = {
//Check there was less than one hour //Check there was less than one hour
if(difference == 0) if(difference == 0)
return minutes + "min"; return lang("dates_min", [minutes]);
//Calculate hours //Calculate hours
@ -45,7 +45,7 @@ ComunicWeb.common.date = {
//Check there was less than a day //Check there was less than a day
if(difference == 0) if(difference == 0)
return hours + "h"; return lang("dates_h", [hours]);
//Calculate days //Calculate days
@ -55,9 +55,9 @@ ComunicWeb.common.date = {
//Check there was less than a month //Check there was less than a month
if(difference == 0){ if(difference == 0){
if(days == 1) if(days == 1)
return "1 day"; return lang("dates_one_day");
else else
return days + " days"; return lang("dates_days", [days]);
} }
@ -68,19 +68,19 @@ ComunicWeb.common.date = {
//Check there was less than a year //Check there was less than a year
if(difference == 0){ if(difference == 0){
if(months == 1) if(months == 1)
return "1 month"; return lang("dates_one_month");
else else
return months + " months"; return lang("dates_months", [months]);
} }
//Calculate years //Calculate years
var years = difference; var years = difference;
if(years == 1){ if(years == 1){
return "1 year"; return lang("dates_one_year");
} }
else { else {
return years + " years"; return lang("dates_years", [years]);
} }
}, },

View File

@ -147,7 +147,7 @@ ComunicWeb.components.comments.ui = {
createElem2({ createElem2({
appendTo: rightContainer, appendTo: rightContainer,
type: "span", type: "span",
innerHTML: ComunicWeb.common.date.timeDiffToStr(infos.time_sent) + " ago" innerHTML: lang("dates_ago", [ComunicWeb.common.date.timeDiffToStr(infos.time_sent)])
}); });
//Offer the user the possibility to delete and update the comment if he is allowed to do so //Offer the user the possibility to delete and update the comment if he is allowed to do so

View File

@ -69,7 +69,7 @@ ComunicWeb.components.posts.ui = {
}); });
//Show the age of the post //Show the age of the post
postDescription.innerHTML = ComunicWeb.common.date.timeDiffToStr(info.post_time) + " ago"; postDescription.innerHTML = lang("dates_ago", [ComunicWeb.common.date.timeDiffToStr(info.post_time)]);
/** /**

View File

@ -18,6 +18,18 @@ ComunicWeb.common.langs.en = {
"__fatal_error": "Fatal error", "__fatal_error": "Fatal error",
"__fatal_error_explanation": "A fatal error occured : <i>%p</i>. Please try to refresh the page...", "__fatal_error_explanation": "A fatal error occured : <i>%p</i>. Please try to refresh the page...",
//Dates
dates_s: "%p s",
dates_min: "%p min",
dates_h: "% h",
dates_one_day: "1 day",
dates_days: "%p days",
dates_one_month: "1 month",
dates_months: "%p months",
dates_one_year: "1 year",
dates_years: "%p years",
dates_ago: "%p ago",
//Messages //Messages
messages_loading_layout_title: "Loading", messages_loading_layout_title: "Loading",
messages_loading_layout_message: "Please wait while this page is loading...", messages_loading_layout_message: "Please wait while this page is loading...",