Internationalization of the util part

This commit is contained in:
Blakko 2013-07-08 12:33:05 +02:00
parent eb3eba9c5e
commit 5e10a91175
5 changed files with 30 additions and 19 deletions

View File

@ -96,7 +96,7 @@ DateTimeUtil.setIso8601Date = function(dateObject, string) {
var d = string.match(DateTimeUtil._dateRegexp);
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
@ -153,7 +153,7 @@ DateTimeUtil.setIso8601Time = function (dateObject, string) {
var d = string.match(DateTimeUtil._timeRegexp);
if(!d) {
SimileAjax.Debug.warn("Invalid time string: " + string);
SimileAjax.Debug.warn($.i18n._('core-util-enc')["invalid-date"]+": " + string);
return false;
}
var hours = d[1];

View File

@ -113,7 +113,7 @@ DialogSystem.showBusy = function(message) {
var body = $('<div>').attr('id', 'loading-message').appendTo(frame);
$('<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);

View File

@ -64,22 +64,22 @@ function formatRelativeDate(d) {
var tomorrow = Date.today().add({ days: 1 });
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)) {
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)) {
var diff = Math.floor((today.getDayOfYear() - d.getDayOfYear()) / 7);
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)) {
var diff = today.getMonth() - d.getMonth();
if (diff < 1) {
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 {
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"];
}
}

View File

@ -1,11 +1,11 @@
<div class="dialog-frame" style="width: 600px;">
<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 id="select-encodings-tabs" class="refine-tabs">
<ul>
<li><a href="#select-encodings-tabs-common">Common Encodings</a></li>
<li><a href="#select-encodings-tabs-all">All Encodings</a></li>
<li><a href="#select-encodings-tabs-common" id="or-enc-common"></a></li>
<li><a href="#select-encodings-tabs-all" id="or-enc-all"></a></li>
</ul>
<div id="select-encodings-tabs-common">
<div class="select-encoding-dialog-encoding-list" bind="commonList"></div>
@ -16,7 +16,7 @@
</div>
</div>
<div class="dialog-footer" bind="dialogFooter">
<button class="button" bind="cancelButton">Cancel</button>
<button class="button" bind="cancelButton"></button>
</div>
</div>
</div>

View File

@ -113,13 +113,6 @@
"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."
},
"core-util-enc": {
"select-enc": "Select Encoding",
"common": "Common Encodings",
"all": "All Encodings",
"encoding": "Encoding",
"aliases": "Aliases"
},
"core-dialogs": {
"cluster-edit": "Cluster & Edit column",
"cluster-size": "Cluster Size",
@ -350,6 +343,24 @@
"fb-en-ns": "the Wikipedia English 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": {
"cancel": "Cancel",
"ok": "&nbsp;&nbsp;OK&nbsp;&nbsp;",