Internationalization of the util part
This commit is contained in:
parent
eb3eba9c5e
commit
5e10a91175
@ -96,7 +96,7 @@ DateTimeUtil.setIso8601Date = function(dateObject, string) {
|
|||||||
|
|
||||||
var d = string.match(DateTimeUtil._dateRegexp);
|
var d = string.match(DateTimeUtil._dateRegexp);
|
||||||
if(!d) {
|
if(!d) {
|
||||||
throw new Error("Invalid date string: " + string);
|
throw new Error($.i18n._('core-util-enc')["invalid-date"]+": " + string);
|
||||||
}
|
}
|
||||||
|
|
||||||
var sign = (d[1] == "-") ? -1 : 1; // BC or AD
|
var sign = (d[1] == "-") ? -1 : 1; // BC or AD
|
||||||
@ -153,7 +153,7 @@ DateTimeUtil.setIso8601Time = function (dateObject, string) {
|
|||||||
|
|
||||||
var d = string.match(DateTimeUtil._timeRegexp);
|
var d = string.match(DateTimeUtil._timeRegexp);
|
||||||
if(!d) {
|
if(!d) {
|
||||||
SimileAjax.Debug.warn("Invalid time string: " + string);
|
SimileAjax.Debug.warn($.i18n._('core-util-enc')["invalid-date"]+": " + string);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var hours = d[1];
|
var hours = d[1];
|
||||||
|
@ -113,7 +113,7 @@ DialogSystem.showBusy = function(message) {
|
|||||||
|
|
||||||
var body = $('<div>').attr('id', 'loading-message').appendTo(frame);
|
var body = $('<div>').attr('id', 'loading-message').appendTo(frame);
|
||||||
$('<img>').attr("src", "images/large-spinner.gif").appendTo(body);
|
$('<img>').attr("src", "images/large-spinner.gif").appendTo(body);
|
||||||
$('<span>').html(" " + (message || "Working...")).appendTo(body);
|
$('<span>').html(" " + (message || $.i18n._('core-util-enc')["working"]+"...")).appendTo(body);
|
||||||
|
|
||||||
var level = DialogSystem.showDialog(frame);
|
var level = DialogSystem.showDialog(frame);
|
||||||
|
|
||||||
|
@ -64,22 +64,22 @@ function formatRelativeDate(d) {
|
|||||||
var tomorrow = Date.today().add({ days: 1 });
|
var tomorrow = Date.today().add({ days: 1 });
|
||||||
|
|
||||||
if (d.between(today, tomorrow)) {
|
if (d.between(today, tomorrow)) {
|
||||||
return "today " + d.toString("h:mm tt");
|
return $.i18n._('core-util-enc')["today"]+" " + d.toString("h:mm tt");
|
||||||
} else if (d.between(last_week, today)) {
|
} else if (d.between(last_week, today)) {
|
||||||
var diff = Math.floor(today.getDayOfYear() - d.getDayOfYear());
|
var diff = Math.floor(today.getDayOfYear() - d.getDayOfYear());
|
||||||
return (diff <= 1) ? ("yesterday " + d.toString("h:mm tt")) : (diff + " days ago");
|
return (diff <= 1) ? ($.i18n._('core-util-enc')["yesterday"]+" " + d.toString("h:mm tt")) : (diff + " "+$.i18n._('core-util-enc')["days-ago"]);
|
||||||
} else if (d.between(last_month, today)) {
|
} else if (d.between(last_month, today)) {
|
||||||
var diff = Math.floor((today.getDayOfYear() - d.getDayOfYear()) / 7);
|
var diff = Math.floor((today.getDayOfYear() - d.getDayOfYear()) / 7);
|
||||||
if (diff < 1) {diff += 52};
|
if (diff < 1) {diff += 52};
|
||||||
return (diff == 1) ? "a week ago" : diff.toFixed(0) + " weeks ago" ;
|
return (diff == 1) ? $.i18n._('core-util-enc')["week-ago"] : diff.toFixed(0) + " "+$.i18n._('core-util-enc')["weeks-ago"] ;
|
||||||
} else if (d.between(almost_last_year, today)) {
|
} else if (d.between(almost_last_year, today)) {
|
||||||
var diff = today.getMonth() - d.getMonth();
|
var diff = today.getMonth() - d.getMonth();
|
||||||
if (diff < 1) {
|
if (diff < 1) {
|
||||||
diff += 12;
|
diff += 12;
|
||||||
}
|
}
|
||||||
return (diff == 1) ? "a month ago" : diff + " months ago";
|
return (diff == 1) ? $.i18n._('core-util-enc')["month-ago"] : diff + " "+ $.i18n._('core-util-enc')["months-ago"];
|
||||||
} else {
|
} else {
|
||||||
var diff = Math.floor(today.getYear() - d.getYear());
|
var diff = Math.floor(today.getYear() - d.getYear());
|
||||||
return (diff == 1) ? "a year ago" : diff + " years ago";
|
return (diff == 1) ? $.i18n._('core-util-enc')["year-ago"] : diff + " "+$.i18n._('core-util-enc')["years-ago"];
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,11 @@
|
|||||||
<div class="dialog-frame" style="width: 600px;">
|
<div class="dialog-frame" style="width: 600px;">
|
||||||
<div class="dialog-border">
|
<div class="dialog-border">
|
||||||
<div class="dialog-header" bind="dialogHeader">Select Encoding</div>
|
<div class="dialog-header" bind="dialogHeader"></div>
|
||||||
<div class="dialog-body" bind="dialogBody">
|
<div class="dialog-body" bind="dialogBody">
|
||||||
<div id="select-encodings-tabs" class="refine-tabs">
|
<div id="select-encodings-tabs" class="refine-tabs">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#select-encodings-tabs-common">Common Encodings</a></li>
|
<li><a href="#select-encodings-tabs-common" id="or-enc-common"></a></li>
|
||||||
<li><a href="#select-encodings-tabs-all">All Encodings</a></li>
|
<li><a href="#select-encodings-tabs-all" id="or-enc-all"></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div id="select-encodings-tabs-common">
|
<div id="select-encodings-tabs-common">
|
||||||
<div class="select-encoding-dialog-encoding-list" bind="commonList"></div>
|
<div class="select-encoding-dialog-encoding-list" bind="commonList"></div>
|
||||||
@ -16,7 +16,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="dialog-footer" bind="dialogFooter">
|
<div class="dialog-footer" bind="dialogFooter">
|
||||||
<button class="button" bind="cancelButton">Cancel</button>
|
<button class="button" bind="cancelButton"></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -113,13 +113,6 @@
|
|||||||
"quotation-mark": "Quotation marks are used<br/>to enclose cells containing<br/>column separators",
|
"quotation-mark": "Quotation marks are used<br/>to enclose cells containing<br/>column separators",
|
||||||
"click-xml": "Click on the first XML element corresponding to the first record to load."
|
"click-xml": "Click on the first XML element corresponding to the first record to load."
|
||||||
},
|
},
|
||||||
"core-util-enc": {
|
|
||||||
"select-enc": "Select Encoding",
|
|
||||||
"common": "Common Encodings",
|
|
||||||
"all": "All Encodings",
|
|
||||||
"encoding": "Encoding",
|
|
||||||
"aliases": "Aliases"
|
|
||||||
},
|
|
||||||
"core-dialogs": {
|
"core-dialogs": {
|
||||||
"cluster-edit": "Cluster & Edit column",
|
"cluster-edit": "Cluster & Edit column",
|
||||||
"cluster-size": "Cluster Size",
|
"cluster-size": "Cluster Size",
|
||||||
@ -350,6 +343,24 @@
|
|||||||
"fb-en-ns": "the Wikipedia English namespace",
|
"fb-en-ns": "the Wikipedia English namespace",
|
||||||
"this-ns": "this namespace:"
|
"this-ns": "this namespace:"
|
||||||
},
|
},
|
||||||
|
"core-util-enc": {
|
||||||
|
"select-enc": "Select Encoding",
|
||||||
|
"common": "Common Encodings",
|
||||||
|
"all": "All Encodings",
|
||||||
|
"encoding": "Encoding",
|
||||||
|
"aliases": "Aliases",
|
||||||
|
"today": "today",
|
||||||
|
"yesterday": "yesterday",
|
||||||
|
"days-ago": "days ago",
|
||||||
|
"week-ago": "a week ago",
|
||||||
|
"weeks-ago": "weeks ago",
|
||||||
|
"month-ago": "a month ago",
|
||||||
|
"months-ago": "months ago",
|
||||||
|
"year-ago": "a year ago",
|
||||||
|
"years-ago": "years ago",
|
||||||
|
"working": "Working",
|
||||||
|
"invalid-date": "Invalid date string"
|
||||||
|
},
|
||||||
"core-buttons": {
|
"core-buttons": {
|
||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
"ok": " OK ",
|
"ok": " OK ",
|
||||||
|
Loading…
Reference in New Issue
Block a user