Skip to content

Commit 66ca6de

Browse files
committed
Merge branch 'master' of https://github.com/nsulzycki/HTML_CodeSniffer into translation
2 parents aec6f37 + 5bb1df0 commit 66ca6de

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1066
-238
lines changed

Auditor/HTMLCSAuditor.js

Lines changed: 50 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ _global.HTMLCSAuditor = new function()
151151
var header = _doc.createElement('div');
152152
header.className = _prefix + 'header';
153153
header.innerHTML = 'HTML_CodeSniffer by Squiz';
154-
header.setAttribute('title', 'Using standard ' + standard);
154+
header.setAttribute('title', _global.translation["auditor_using_standard"] + standard);
155155

156156
var dragging = false;
157157
var prevX = 0;
@@ -202,7 +202,7 @@ _global.HTMLCSAuditor = new function()
202202

203203
var closeIcon = _doc.createElement('div');
204204
closeIcon.className = _prefix + 'close';
205-
closeIcon.setAttribute('title', 'Close');
205+
closeIcon.setAttribute('title', _global.translation["auditor_close"]);
206206
closeIcon.onmousedown = function() {
207207
self.close.call(self);
208208
}
@@ -237,25 +237,25 @@ _global.HTMLCSAuditor = new function()
237237
var divider = ', &#160;<span class="' + _prefix + 'divider"></span>';
238238

239239
if (errors > 0) {
240-
var typeName = 'Errors';
240+
var typeName = _global.translation["auditor_errors"];
241241
if (errors === 1) {
242-
typeName = 'Error';
242+
typeName = _global.translation["auditor_error"];
243243
}
244244
leftContents.push('<strong>' + errors + '</strong> ' + typeName);
245245
}
246246

247247
if (warnings > 0) {
248-
var typeName = 'Warnings';
248+
var typeName = _global.translation["auditor_warnings"];
249249
if (warnings === 1) {
250-
typeName = 'Warning';
250+
typeName = _global.translation["auditor_warning"];
251251
}
252252
leftContents.push('<strong>' + warnings + '</strong> ' + typeName);
253253
}
254254

255255
if (notices > 0) {
256-
var typeName = 'Notices';
256+
var typeName = _global.translation["auditor_notices"];
257257
if (notices === 1) {
258-
typeName = 'Notice';
258+
typeName = _global.translation["auditor_notice"];
259259
}
260260
leftContents.push('<strong>' + notices + '</strong> ' + typeName);
261261
}
@@ -325,7 +325,7 @@ _global.HTMLCSAuditor = new function()
325325
lineageHomeLink.href = 'javascript:';
326326

327327
var lineageHomeSpan = _doc.createElement('span');
328-
lineageHomeSpan.innerHTML = 'Home';
328+
lineageHomeSpan.innerHTML = _global.translation["auditor_home"];
329329
lineageHomeLink.appendChild(lineageHomeSpan);
330330

331331
lineageHomeLink.onmousedown = function() {
@@ -339,8 +339,8 @@ _global.HTMLCSAuditor = new function()
339339
var lineageReportLink = _doc.createElement('a');
340340
lineageReportLink.className = _prefix + 'lineage-link';
341341
lineageReportLink.href = 'javascript:';
342-
lineageReportLink.innerHTML = 'Report';
343-
lineageReportLink.setAttribute('title', 'Back to Report');
342+
lineageReportLink.innerHTML = _global.translation["auditor_report"];
343+
lineageReportLink.setAttribute('title', _global.translation["auditor_back_to_report"]);
344344

345345
lineageReportLink.onmousedown = function() {
346346
var list = _doc.querySelectorAll('.HTMLCS-inner-wrapper')[0];
@@ -355,7 +355,7 @@ _global.HTMLCSAuditor = new function()
355355
// Issue Count item.
356356
var lineageTotalsItem = _doc.createElement('li');
357357
lineageTotalsItem.className = _prefix + 'lineage-item';
358-
lineageTotalsItem.innerHTML = 'Issue ' + issue + ' of ' + totalIssues;
358+
lineageTotalsItem.innerHTML = _global.translation["auditor_issue"] + ' ' + issue + ' ' + _global.translation["auditor_of"] + ' ' + totalIssues;
359359

360360
lineageHomeItem.appendChild(lineageHomeLink);
361361
lineageReportItem.appendChild(lineageReportLink);
@@ -367,7 +367,7 @@ _global.HTMLCSAuditor = new function()
367367
var buttonGroup = _doc.createElement('div');
368368
buttonGroup.className = _prefix + 'button-group';
369369

370-
var prevButton = buildSummaryButton(_prefix + 'button-previous-issue', 'previous', 'Previous Issue', function(target) {
370+
var prevButton = buildSummaryButton(_prefix + 'button-previous-issue', 'previous', _global.translation["auditor_previous_issue"], function(target) {
371371
var newIssue = Number(issue) - 1;
372372

373373
if (newIssue >= 1) {
@@ -383,7 +383,7 @@ _global.HTMLCSAuditor = new function()
383383
}//end if
384384
});
385385

386-
var nextButton = buildSummaryButton(_prefix + 'button-next-issue', 'next', 'Next Issue', function(target) {
386+
var nextButton = buildSummaryButton(_prefix + 'button-next-issue', 'next', _global.translation["auditor_next_issue"], function(target) {
387387
var newIssue = Number(issue) + 1;
388388

389389
if (newIssue <= _messages.length) {
@@ -481,7 +481,7 @@ _global.HTMLCSAuditor = new function()
481481
useStandardDiv.id = _prefix + 'settings-use-standard';
482482

483483
var useStandardLabel = _doc.createElement('label');
484-
useStandardLabel.innerHTML = 'Standards:';
484+
useStandardLabel.innerHTML = _global.translation["auditor_standards"] + ':';
485485
useStandardLabel.setAttribute('for', _prefix + 'settings-use-standard-select');
486486

487487
var useStandardSelect = _doc.createElement('select');
@@ -511,11 +511,11 @@ _global.HTMLCSAuditor = new function()
511511

512512
var issueCountHelpDiv = _doc.createElement('div');
513513
issueCountHelpDiv.id = _prefix + 'settings-issue-count-help';
514-
issueCountHelpDiv.innerHTML = 'Select the types of issues to include in the report';
514+
issueCountHelpDiv.innerHTML = _global.translation["auditor_select_types"];
515515

516516
var viewReportDiv = _doc.createElement('div');
517517
viewReportDiv.id = _prefix + 'settings-view-report';
518-
viewReportDiv.innerHTML = 'View Report';
518+
viewReportDiv.innerHTML = _global.translation["auditor_view_report"];
519519

520520
viewReportDiv.onclick = function() {
521521
if (/disabled/.test(this.className) === false) {
@@ -563,15 +563,33 @@ _global.HTMLCSAuditor = new function()
563563
var msgCount = levels[level];
564564
var levelDiv = _doc.createElement('div');
565565
levelDiv.className = _prefix + 'issue-tile ' + _prefix + level.toLowerCase();
566-
566+
var levelName = null;
567567
var levelCountDiv = _doc.createElement('div');
568568
levelCountDiv.className = 'HTMLCS-tile-text';
569569

570-
var content = '<strong>' + msgCount + '</strong> ' + level.substr(0, 1).toUpperCase() + level.substr(1);
571-
if (msgCount !== 1) {
572-
content += 's';
570+
if(level == "error") {
571+
levelName = _global.translation['auditor_error'];
572+
if (msgCount !== 1) {
573+
levelName = _global.translation['auditor_errors'];
574+
}
575+
}
576+
577+
if(level == "warning") {
578+
levelName = _global.translation['auditor_warning'];
579+
if (msgCount !== 1) {
580+
levelName = _global.translation['auditor_warnings'];
581+
}
573582
}
574583

584+
if(level == "notice") {
585+
levelName = _global.translation['auditor_notice'];
586+
if (msgCount !== 1) {
587+
levelName = _global.translation['auditor_notices'];
588+
}
589+
}
590+
var content = '<strong>' + msgCount + '</strong> ' + levelName;
591+
592+
575593
levelCountDiv.innerHTML = content;
576594

577595
if (_options.show === undefined) {
@@ -796,18 +814,18 @@ _global.HTMLCSAuditor = new function()
796814

797815
var msgElementSourceInner = _doc.createElement('div');
798816
msgElementSourceInner.className = _prefix + 'issue-source-inner-u2p';
799-
var msg = 'Unable to point to the element associated with this issue.';
817+
var msg = _global.translation['auditor_unable_to_point'];
800818

801819
if (message.element.ownerDocument === null) {
802-
msg = 'Unable to point to this issue, as it relates to the entire document.';
820+
msg = _global.translation['auditor_unable_to_point_removed'];
803821
} else {
804822
var body = message.element.ownerDocument.getElementsByTagName('body')[0];
805823
if (HTMLCS.util.isInDocument(message.element) === false) {
806-
msg += 'Unable to point to this element as it has been removed from the document since the report was generated.';
824+
msg += _global.translation['auditor_unable_to_point_entire'];
807825
} else if (HTMLCS.util.contains(body, message.element) === false) {
808-
msg = 'Unable to point to this element because it is located outside the document\'s body element.';
826+
msg = _global.translation['auditor_unable_to_point_outside'];
809827
} else {
810-
msg += 'Unable to point to this element because it is hidden from view, or does not have a visual representation.';
828+
msg += _global.translation['auditor_unable_to_point_outside'];
811829
}
812830
}
813831

@@ -837,9 +855,9 @@ _global.HTMLCSAuditor = new function()
837855
msgElementSourceHeader.className = _prefix + 'issue-source-header';
838856

839857
var msgSourceHeaderText = _doc.createElement('strong');
840-
msgSourceHeaderText.innerHTML = 'Code Snippet';
858+
msgSourceHeaderText.innerHTML = _global.translation["auditor_code_snippet"];
841859

842-
var btnPointTo = buildSummaryButton(_prefix + 'button-point-to-element-' + id, 'pointer', 'Point to Element', function() {
860+
var btnPointTo = buildSummaryButton(_prefix + 'button-point-to-element-' + id, 'pointer', _global.translation["auditor_point_to_element"], function() {
843861
self.pointToElement(message.element);
844862
});
845863

@@ -958,7 +976,8 @@ _global.HTMLCSAuditor = new function()
958976

959977
var pageNum = _doc.createElement('span');
960978
pageNum.className = _prefix + 'page-number';
961-
pageNum.innerHTML = 'Page ' + page + ' of ' + totalPages;
979+
// pageNum.innerHTML = 'Page ' + page + ' of ' + totalPages;
980+
pageNum.innerHTML = _global.translation["auditor_issue"] + ' ' + page + ' ' + _global.translation["auditor_of"] + ' ' + totalPages;
962981
navDiv.appendChild(pageNum);
963982

964983
var next = _doc.createElement('span');
@@ -984,7 +1003,7 @@ _global.HTMLCSAuditor = new function()
9841003
}
9851004

9861005
pageNum.innerHTML = '';
987-
pageNum.appendChild(document.createTextNode('Page ' + _page + ' of ' + totalPages));
1006+
pageNum.appendChild(document.createTextNode(_global.translation["auditor_issue"] + ' ' + _page + ' ' + _global.translation["auditor_of"] + ' ' + totalPages));
9881007

9891008
var issueList = _doc.querySelectorAll('.HTMLCS-issue-list')[0];
9901009
issueList.style.marginLeft = ((_page - 1) * -300) + 'px';
@@ -1003,7 +1022,7 @@ _global.HTMLCSAuditor = new function()
10031022
}
10041023

10051024
pageNum.innerHTML = '';
1006-
pageNum.appendChild(document.createTextNode('Page ' + _page + ' of ' + totalPages));
1025+
pageNum.appendChild(document.createTextNode(_global.translation["auditor_issue"] + ' ' + _page + ' ' + _global.translation["auditor_of"] + ' ' + totalPages));
10071026

10081027
var issueList = _doc.querySelectorAll('.HTMLCS-issue-list')[0];
10091028
issueList.style.marginLeft = ((_page - 1) * -300) + 'px';

Contrib/PhantomJS/HTMLCS_Run.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ if (system.args.length < 3 || system.args.length > 4) {
9090
}
9191

9292
console.log('');
93-
console.log('Errors: ' + messages['ERROR'].length + ', Warnings: ' + messages['WARNING'].length +
94-
', Notices: ' + messages['NOTICE'].length);
93+
console.log(_global.translation["auditor_errors"] + ': ' + messages['ERROR'].length + ', ' + _global.translation["auditor_warnings"] + ': ' + messages['WARNING'].length +
94+
', ' + _global.translation["auditor_notices"] + ': ' + messages['NOTICE'].length);
9595
cb();
9696
}
9797

Contrib/PhantomJS/runner.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ var HTMLCS_RUNNER = _global.HTMLCS_RUNNER = new function() {
2727
var typeName = 'UNKNOWN';
2828
switch (msg.type) {
2929
case HTMLCS.ERROR:
30-
typeName = 'ERROR';
30+
typeName = _global.translation["auditor_errors"];
3131
break;
3232

3333
case HTMLCS.WARNING:
34-
typeName = 'WARNING';
34+
typeName = _global.translation["auditor_warnings"];
3535
break;
3636

3737
case HTMLCS.NOTICE:
38-
typeName = 'NOTICE';
38+
typeName = _global.translation["auditor_notices"];
3939
break;
4040
}//end switch
4141

0 commit comments

Comments
 (0)