66 lines
2.3 KiB
JavaScript
66 lines
2.3 KiB
JavaScript
(function(){
|
||
function n(b,a,e){
|
||
e||(e=r);
|
||
var d={};
|
||
b=[b];
|
||
for(var f,j={},h;h=b.length;){
|
||
f=s;
|
||
for(var c=0;c<h;c++){
|
||
var g=b[c];if(!(!g||j[g])){
|
||
var i=e[g];
|
||
if(i)f=f.concat(i);
|
||
if(i=a[g])
|
||
for(var k in i)!i.hasOwnProperty(k)||d.hasOwnProperty(k)||(d[k]=i[k]);
|
||
j[g]=true
|
||
}
|
||
}
|
||
b=f
|
||
}
|
||
return d
|
||
}
|
||
function o(b,a){
|
||
if(b=="ru"){
|
||
a=t(a)%100;
|
||
return a%10===1&&a%100!==11?1:a%10>=2&&a%10<=4&&(a%100<10||a%100>=20)?2:0
|
||
}
|
||
else return b=="en"?a==1||a==-1?1:0:0
|
||
}
|
||
function u(b,a,e){
|
||
var d=a[e+"G"];
|
||
if(d)return d;
|
||
a=a[e];
|
||
if(b=="ru")
|
||
if(v.test(a))
|
||
return"F";
|
||
else if(w.test(a))
|
||
return"P";
|
||
return"M"
|
||
}
|
||
function x(b,a,e,d){
|
||
var f,j=e&&e;
|
||
f=p[b]||(p[b]=n(b,y));
|
||
if(a<=0)return"0В "+(d&&f["second0"+d]||f.second0);
|
||
var h,c;l.length=0;
|
||
for(var g=z;g-=2;){
|
||
c=m[g];
|
||
if(a>=c){
|
||
if(c===1)h=a;
|
||
else a-=(h=A(a/c))*c;c=m[g+1]+o(b,h);
|
||
l.push(h+"В "+(d&&f[c+d]||f[c]));
|
||
if(e&&!--j)break
|
||
}
|
||
}
|
||
return l.join(" ")
|
||
}
|
||
function q(b){
|
||
var a=b.LocalText;
|
||
a||(b.LocalText=a={});
|
||
a.Inherit=n;
|
||
a.phpuralForm=o;
|
||
a.Gender=u;
|
||
a.PeriodToText=x;
|
||
a.ExportTo=q
|
||
}
|
||
var r={ja:["en","zh"],en:["ru"]},s=[],l=[],t=Math.abs,A=Math.floor,v=/[ая]$/i,w=/[иы]$/i,y={ru:{year0:"лет",year1:"год",year2:"года",month0:"месяцев",month1:"месяц",month2:"месяца",week0:"недель",week1:"неделя",week1ACC:"неделю",week2:"недели",day0:"дней",day1:"день",day2:"дня",hour0:"часов",hour1:"час",hour2:"часа",minute0:"минут",minute1:"минута",minute1ACC:"минуту",minute2:"минуты",second0:"секунд",second1:"секунда",second1ACC:"секунду",second2:"секунды"},en:{year0:"years",year1:"year",month0:"months",month1:"month",week0:"weeks",week1:"week",day0:"days",day1:"day",hour0:"hours",hour1:"hour",minute0:"minutes",minute1:"minute",second0:"seconds",second1:"second"}},m=[0,0,1,"second",60,"minute",3600,"hour",86400,"day",604800,"week",2592E3,"month",31536E3,"year"],z=m.length,p={};
|
||
q(this);
|
||
typeof DLoad==="object"&&(new DLoad.pkg("LocalText")).complete()})() |