Не нравятся результаты поиска? Попробуйте другой поиск!
DLE FAQ » Стол заказов » Перевести даты в libs.js на английский

Перевести даты в libs.js на английский


 berch    08.09.2018    Стол заказов    956    3 комментария

Здравствуйте! Нужно перевести русские даты на английский, со всеми склонениями, как в русском. Переводы есть внутри кода.

!function(t){"function"==typeof define&&define.amd?define(["../../../engine/classes/js/jquery"],t):t(jQuery)}(function(t){function e(){var e=n(this);return isNaN(e.datetime)||t(this).text(r(e.datetime)),this}function n(e){if(!(e=t(e)).data("timeago")){e.data("timeago",{datetime:a.datetime(e)});var n=t.trim(e.text());a.settings.localeTitle?e.attr("title",e.data("timeago").datetime.toLocaleString()):!(n.length>0)||a.isTime(e)&&e.attr("title")||e.attr("title",n)}return e.data("timeago")}function r(t){return a.inWords(i(t))}function i(t){return(new Date).getTime()-t.getTime()}t.timeago=function(e){return r(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):"number"==typeof e?new Date(e):t.timeago.datetime(e))};var a=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,localeTitle:!1,strings:{prefixAgo:null,prefixFromNow:null,suffixAgo:"ago",suffixFromNow:"from now",seconds:"less than a minute",minute:"about a minute",minutes:"%d minutes",hour:"about an hour",hours:"about %d hours",day:"a day",days:"%d days",month:"about a month",months:"%d months",year:"about a year",years:"%d years",wordSeparator:" ",numbers:[]}},inWords:function(e){function n(n,i){var a=t.isFunction(n)?n(i,e):n,o=r.numbers&&r.numbers[i]||i;return a.replace(/%d/i,o)}var r=this.settings.strings,i=r.prefixAgo,a=r.suffixAgo;this.settings.allowFuture&&e<0&&(i=r.prefixFromNow,a=r.suffixFromNow);var o=Math.abs(e)/1e3,u=o/60,s=u/60,d=s/24,m=d/365,f=o<45&&n(r.seconds,Math.round(o))||o<90&&n(r.minute,1)||u<45&&n(r.minutes,Math.round(u))||u<90&&n(r.hour,1)||s<24&&n(r.hours,Math.round(s))||s<42&&n(r.day,1)||d<30&&n(r.days,Math.round(d))||d<45&&n(r.month,1)||d<365&&n(r.months,Math.round(d/30))||m<1.5&&n(r.year,1)||n(r.years,Math.round(m)),c=r.wordSeparator||"";return void 0===r.wordSeparator&&(c=" "),t.trim([i,f,a].join(c))},parse:function(e){var n=t.trim(e);return n=n.replace(/\.\d+/,""),n=n.replace(/-/,"/").replace(/-/,"/"),n=n.replace(/T/," ").replace(/Z/," UTC"),n=n.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),new Date(n)},datetime:function(e){var n=a.isTime(e)?t(e).attr("datetime"):t(e).attr("title");return a.parse(n)},isTime:function(e){return"time"===t(e).get(0).tagName.toLowerCase()}});var o={init:function(){var n=t.proxy(e,this);n();var r=a.settings;r.refreshMillis>0&&setInterval(n,r.refreshMillis)},update:function(n){t(this).data("timeago",{datetime:a.parse(n)}),e.apply(this)}};t.fn.timeago=function(t,e){var n=t?o[t]:o.init;if(!n)throw new Error("Unknown function name '"+t+"' for timeago");return this.each(function(){n.call(this,e)}),this},document.createElement("abbr"),document.createElement("time")}),function(){function t(t,e,n,r){var i=t%10;return 1==i&&(1==t||t>20)?e:i>1&&i<5&&(t>20||t<10)?n:r}jQuery.timeago.settings.strings={prefixAgo:null,prefixFromNow:"через",suffixAgo:"назад",suffixFromNow:null,seconds:"меньше минуты",minute:"минуту",minutes:function(e){return t(e,"%d минута","%d минуты","%d минут")},hour:"час",hours:function(e){return t(e,"%d час","%d часа","%d часов")},day:"день",days:function(e){return t(e,"%d день","%d дня","%d дней")},month:"месяц",months:function(e){return t(e,"%d месяц","%d месяца","%d месяцев")},year:"год",years:function(e){return t(e,"%d год","%d года","%d лет")}}}(),$("time.ago").timeago(),$(document).on("click",".unsubcomm",function(){ShowLoading();var t=$(this);$.post(dle_root+"engine/ajax/subscribe.php",{post_id:$("#post_id").val()},function(e){HideLoading(),e.error?DLEalert(e.error,"Ошибка"):t.html(e.html)},"json")});

3 комментария

kovalenko3331
Юзер

kovalenko3331 - 8 сентября 2018 12:42 -

Пишите в скайп live:kovalenko3331 помогу.

jakal
Юзер

jakal - 8 сентября 2018 13:35 -

А в чём проблема скачать английский вариант DLE и взять оттуда этот файл?
dle-news точка com

berch
Юзер

berch - 8 сентября 2018 17:35 -

Это не файл с оригинального шаблона, смотрел уже.

Чтобы комментировать - войдите или зарегистрируйтесь на сайте
наверх