Skip to content

Commit a604a66

Browse files
authored
Merge pull request #257 from jamadam/translatability
Improved translatability for non-SVO grammers
2 parents 5ca0b9b + a8a2e60 commit a604a66

6 files changed

Lines changed: 29 additions & 30 deletions

File tree

Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_3.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_3 = {
6363
var recommendText = [];
6464
if (recommend) {
6565
if (recommend.fore.from !== recommend.fore.to) {
66-
recommendText.push(_global.HTMLCS.getTranslation("1_4_3_G18_or_G145.Fail.Recomendation.Text") + ' ' + recommend.fore.to);
66+
recommendText.push(_global.HTMLCS.getTranslation("1_4_3_G18_or_G145.Fail.Recomendation.Text").replace(/\{\{value\}\}/g, recommend.fore.to));
6767
}
6868
if (recommend.back.from !== recommend.back.to) {
69-
recommendText.push(_global.HTMLCS.getTranslation("1_4_3_G18_or_G145.Fail.Recomendation.Background") + ' ' + recommend.back.to);
69+
recommendText.push(_global.HTMLCS.getTranslation("1_4_3_G18_or_G145.Fail.Recomendation.Background").replace(/\{\{value\}\}/g, recommend.back.to));
7070
}
7171
}//end if
7272

Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_6.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_6 = {
6262
var recommendText = [];
6363
if (recommend) {
6464
if (recommend.fore.from !== recommend.fore.to) {
65-
recommendText.push(_global.HTMLCS.getTranslation("1_4_6_G18_or_G17.Fail.Recomendation.Text") + ' ' + recommend.fore.to);
65+
recommendText.push(_global.HTMLCS.getTranslation("1_4_6_G18_or_G17.Fail.Recomendation.Text").replace(/\{\{value\}\}/g, recommend.fore.to));
6666
}
6767
if (recommend.back.from !== recommend.back.to) {
68-
recommendText.push(_global.HTMLCS.getTranslation("1_4_6_G18_or_G17.Fail.Recomendation.Background") + recommend.back.to);
68+
recommendText.push(_global.HTMLCS.getTranslation("1_4_6_G18_or_G17.Fail.Recomendation.Background").replace(/\{\{value\}\}/g, recommend.back.to));
6969
}
7070
}//end if
7171

Standards/WCAG2AAA/Sniffs/Principle4/Guideline4_1/4_1_2.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,6 @@ _global.HTMLCS_WCAG2AAA_Sniffs_Principle4_Guideline4_1_4_1_2 = {
255255
msgNodeType = nodeName.substr(6) + _global.HTMLCS.getTranslation("4_1_2_input_element");
256256
}
257257

258-
if (element.hasAttribute('role') && element.getAttribute('role') === 'button') {
259-
msgNodeType = _global.HTMLCS.getTranslation("4_1_2_role_of_button");
260-
}
261-
262258
var builtAttrs = matchingRequiredNames.slice(0, matchingRequiredNames.length);
263259
for (var a = 0; a < builtAttrs.length; a++) {
264260
if (builtAttrs[a] === '_content') {
@@ -271,6 +267,9 @@ _global.HTMLCS_WCAG2AAA_Sniffs_Principle4_Guideline4_1_4_1_2 = {
271267
}
272268

273269
var msg = _global.HTMLCS.getTranslation("4_1_2_msg_pattern").replace(/\{\{msgNodeType\}\}/g, msgNodeType).replace(/\{\{builtAttrs\}\}/g, builtAttrs.join(', '));
270+
if (element.hasAttribute('role') && element.getAttribute('role') === 'button') {
271+
msg = _global.HTMLCS.getTranslation("4_1_2_msg_pattern_role_of_button").replace(/\{\{builtAttrs\}\}/g, builtAttrs.join(', '))
272+
}
274273
errors.push({
275274
element: element,
276275
msg: msg,
@@ -318,7 +317,7 @@ _global.HTMLCS_WCAG2AAA_Sniffs_Principle4_Guideline4_1_4_1_2 = {
318317
if (valueFound === false) {
319318
var msgNodeType = nodeName + ' ' + _global.HTMLCS.getTranslation("4_1_2_element");
320319
if (nodeName.substr(0, 6) === 'input_') {
321-
msgNodeType = nodeName.substr(6) + ' input element';
320+
msgNodeType = nodeName.substr(6) + _global.HTMLCS.getTranslation("4_1_2_input_element");
322321
}
323322

324323
var msg = _global.HTMLCS.getTranslation("4_1_2_msg_pattern2").replace(/\{\{msgNodeType\}\}/g, msgNodeType);

Translations/en.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,9 @@ _global.translation['en'] = {
179179
,"1_4_3_G18_or_G145.BgImage" : 'This element\'s text is placed on a background image. Ensure the contrast ratio between the text and all covered parts of the image are at least {{required}}:1.'
180180
,"1_4_3_G18_or_G145.Alpha" : 'This element\'s text or background contains transparency. Ensure the contrast ratio between the text and background are at least {{required}}:1.'
181181
,"1_4_3_G18_or_G145.Fail" : 'This element has insufficient contrast at this conformance level. Expected a contrast ratio of at least {{required}}:1, but text in this element has a contrast ratio of {{value}}:1.'
182-
,"1_4_3_G18_or_G145.Fail.Recomendation" : 'Recommendation: change'
183-
,"1_4_3_G18_or_G145.Fail.Recomendation.Text" : 'text colour to'
184-
,"1_4_3_G18_or_G145.Fail.Recomendation.Background" : 'background to'
182+
,"1_4_3_G18_or_G145.Fail.Recomendation" : 'Recommendation: '
183+
,"1_4_3_G18_or_G145.Fail.Recomendation.Text" : 'change text colour to {{value}}'
184+
,"1_4_3_G18_or_G145.Fail.Recomendation.Background" : 'change background to {{value}}'
185185

186186

187187
//1_4_4.js
@@ -196,9 +196,9 @@ _global.translation['en'] = {
196196
,"1_4_6_G18_or_G17.Abs" : 'This element is absolutely positioned and the background color can not be determined. Ensure the contrast ratio between the text and all covered parts of the background are at least {{required}}:1.'
197197
,"1_4_6_G18_or_G17.BgImage" : 'This element\'s text is placed on a background image. Ensure the contrast ratio between the text and all covered parts of the image are at least {{required}}:1.'
198198
,"1_4_6_G18_or_G17.Fail" : 'This element has insufficient contrast at this conformance level. Expected a contrast ratio of at least {{required}}:1, but text in this element has a contrast ratio of {{value}}:1.'
199-
,"1_4_6_G18_or_G17.Fail.Recomendation" : 'Recommendation: change'
200-
,"1_4_6_G18_or_G17.Fail.Recomendation.Text" : 'text colour to'
201-
,"1_4_6_G18_or_G17.Fail.Recomendation.Background" : 'background to'
199+
,"1_4_6_G18_or_G17.Fail.Recomendation" : 'Recommendation: '
200+
,"1_4_6_G18_or_G17.Fail.Recomendation.Text" : 'change text colour to {{value}}'
201+
,"1_4_6_G18_or_G17.Fail.Recomendation.Background" : 'change background to {{value}}'
202202

203203

204204

@@ -399,10 +399,10 @@ _global.translation['en'] = {
399399

400400

401401
,"4_1_2_input_element" : 'input element'
402-
,"4_1_2_role_of_button" : 'element has a role of "button" but'
403402
,"4_1_2_element_content" : 'element content'
404403
,"4_1_2_element" : 'element'
405404
,"4_1_2_msg_pattern" : 'This {{msgNodeType}} does not have a name available to an accessibility API. Valid names are: {{builtAttrs}}.'
405+
,"4_1_2_msg_pattern_role_of_button" : 'This element has role of "button" but does not have a name available to an accessibility API. Valid names are: {{builtAttrs}}.'
406406
,"4_1_2_msg_pattern2" : 'This {{msgNodeType}} does not have a value available to an accessibility API.'
407407
,"4_1_2_msg_add_one" : 'Add one by adding content to the element.'
408408
,"4_1_2_msg_pattern3" : 'This {{msgNodeType}} does not have an initially selected option. Depending on your HTML version, the value exposed to an accessibility API may be undefined.'

Translations/fr.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,9 @@ _global.translation['fr'] = {
179179
,"1_4_3_G18_or_G145.BgImage" : 'Le texte de cet élément est placé sur une image de fond. Assurez-vous que le rapport de contraste entre le texte et toutes les parties couvertes de l\'image est d\'au moins {{nécessaire}}:1.'
180180
,"1_4_3_G18_or_G145.Alpha" : 'Le texte ou l\'arrière-plan de cet élément contient de la transparence. Assurez-vous que le rapport de contraste entre le texte et l\'arrière-plan est d\'au moins {{nécessaire}}:1.'
181181
,"1_4_3_G18_or_G145.Fail" : 'Cet élément a un contraste insuffisant à ce niveau de conformité. On s\'attendait à un rapport de contraste d\'au moins {{required}}:1, mais le texte dans cet élément a un rapport de contraste de {{value}}:1.'
182-
,"1_4_3_G18_or_G145.Fail.Recomendation" : 'Recommandation : changement'
183-
,"1_4_3_G18_or_G145.Fail.Recomendation.Text" : 'Couleur du texte à'
184-
,"1_4_3_G18_or_G145.Fail.Recomendation.Background" : 'Fond à'
182+
,"1_4_3_G18_or_G145.Fail.Recomendation" : 'Recommandation : '
183+
,"1_4_3_G18_or_G145.Fail.Recomendation.Text" : 'changement Couleur du texte à {{value}}'
184+
,"1_4_3_G18_or_G145.Fail.Recomendation.Background" : 'changement Fond à {{value}}'
185185

186186

187187
//1_4_4.js
@@ -196,9 +196,9 @@ _global.translation['fr'] = {
196196
,"1_4_6_G18_or_G17.Abs" : 'Cet élément est absolument positionné et la couleur de fond ne peut pas être déterminée. Assurez-vous que le rapport de contraste entre le texte et toutes les parties couvertes de l\'arrière-plan est d\'au moins {{nécessaire}}:1.'
197197
,"1_4_6_G18_or_G17.BgImage" : 'Le texte de cet élément est placé sur une image de fond. Assurez-vous que le rapport de contraste entre le texte et toutes les parties couvertes de l\'image est d\'au moins {{nécessaire}}:1.'
198198
,"1_4_6_G18_or_G17.Fail" : 'Cet élément a un contraste insuffisant à ce niveau de conformité. On s\'attendait à un rapport de contraste d\'au moins {{required}}:1, mais le texte dans cet élément a un rapport de contraste de {{value}}:1.'
199-
,"1_4_6_G18_or_G17.Fail.Recomendation" : 'Recommandation : changement'
200-
,"1_4_6_G18_or_G17.Fail.Recomendation.Text" : 'Couleur du texte à'
201-
,"1_4_6_G18_or_G17.Fail.Recomendation.Background" : 'Fond à'
199+
,"1_4_6_G18_or_G17.Fail.Recomendation" : 'Recommandation : '
200+
,"1_4_6_G18_or_G17.Fail.Recomendation.Text" : 'changement Couleur du texte à {{value}}'
201+
,"1_4_6_G18_or_G17.Fail.Recomendation.Background" : 'changement Fond à {{value}}'
202202

203203

204204
//1_4_7.js
@@ -396,10 +396,10 @@ _global.translation['fr'] = {
396396

397397

398398
,"4_1_2_input_element" : 'élément d\'entrée'
399-
,"4_1_2_role_of_button" : 'l\'élément a un rôle de "bouton" mais'
400399
,"4_1_2_element_content" : 'contenu de l\'élément'
401400
,"4_1_2_element" : 'élément'
402401
,"4_1_2_msg_pattern" : 'Ce {{msgNodeType}} n\'a pas de nom disponible pour une API d\'accessibilité. Les noms valides le sont : {{builtAttrs}}.'
402+
,"4_1_2_msg_pattern_role_of_button" : 'Ce l\'élément a un rôle de "bouton" mais n\'a pas de nom disponible pour une API d\'accessibilité. Les noms valides le sont : {{builtAttrs}}.'
403403
,"4_1_2_msg_pattern2" : 'Cette {{{msgNodeType}} n\'a pas de valeur disponible pour une API d\'accessibilité.'
404404
,"4_1_2_msg_add_one" : 'Ajouter un en ajoutant du contenu à l\'élément.'
405405
,"4_1_2_msg_pattern3" : 'Cette {{msgNodeType}} n\'a pas d\'option initialement sélectionnée. Selon votre version HTML, la valeur exposée à une API d\'accessibilité peut être indéfinie.'

Translations/pl.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,9 @@ _global.translation['pl'] = {
179179
,"1_4_3_G18_or_G145.BgImage" : 'Tekst elementu wyświetlany jest na obrazku. Należy upewnić się, że stosunek kontrastu tekstu do tła wynosi co najmniej {{required}}:1.'
180180
,"1_4_3_G18_or_G145.Alpha" : 'Tekst lub tło tego elementu jest przezroczyste. Upewnij się, że współczynnik kontrastu między tekstem a tłem wynosi co najmniej {{required}}:1.'
181181
,"1_4_3_G18_or_G145.Fail" : 'Ten element ma niewystarczający na tym poziomie zgodności stosunek kontrastu tekstu do tła. Powinien wynosić co najmniej {{required}}:1, a tekst umieszczony w tym elemencie posiada stosunek {{value}}:1.'
182-
,"1_4_3_G18_or_G145.Fail.Recomendation" : 'Zalecenie: zmiana'
183-
,"1_4_3_G18_or_G145.Fail.Recomendation.Text" : 'koloru tekstu na'
184-
,"1_4_3_G18_or_G145.Fail.Recomendation.Background" : 'koloru tła na'
182+
,"1_4_3_G18_or_G145.Fail.Recomendation" : 'Zalecenie: '
183+
,"1_4_3_G18_or_G145.Fail.Recomendation.Text" : 'zmiana koloru tekstu na {{value}}'
184+
,"1_4_3_G18_or_G145.Fail.Recomendation.Background" : 'zmiana koloru tła na {{value}}'
185185

186186

187187
//1_4_4.js
@@ -196,9 +196,9 @@ _global.translation['pl'] = {
196196
,"1_4_6_G18_or_G17.Abs" : 'Ten element jest pozycjonowany absolutnie i nie jest możliwe zweryfikowanie jego kontrastu. Sprawdź samodzielnie czy kontrast jest na wystarczającym poziomie: {{required}}:1.'
197197
,"1_4_6_G18_or_G17.BgImage" : 'Tekst elementu wyświetlany jest na obrazku. Należy upewnić się, że stosunek kontrastu tekstu do tła wynosi conajmniej {{required}}:1.'
198198
,"1_4_6_G18_or_G17.Fail" : 'Ten element ma niewystarczający stosunek kontrastu tekstu do tła. Powinien wynosić co najmniej {{required}}:1, a tekst umieszczony w tym elemencie posiada stosunek {{value}}:1.'
199-
,"1_4_6_G18_or_G17.Fail.Recomendation" : 'Zalecenie: zmiana'
200-
,"1_4_6_G18_or_G17.Fail.Recomendation.Text" : 'koloru tekstu na'
201-
,"1_4_6_G18_or_G17.Fail.Recomendation.Background" : 'koloru tła na'
199+
,"1_4_6_G18_or_G17.Fail.Recomendation" : 'Zalecenie: '
200+
,"1_4_6_G18_or_G17.Fail.Recomendation.Text" : 'zmiana koloru tekstu na {{value}}'
201+
,"1_4_6_G18_or_G17.Fail.Recomendation.Background" : 'zmiana koloru tła na {{value}}'
202202

203203

204204

@@ -399,10 +399,10 @@ _global.translation['pl'] = {
399399

400400

401401
,"4_1_2_input_element" : 'pole formularza'
402-
,"4_1_2_role_of_button" : 'element ma rolę "button" ale'
403402
,"4_1_2_element_content" : 'zawartość elementu'
404403
,"4_1_2_element" : 'element'
405404
,"4_1_2_msg_pattern" : '{{msgNodeType}} nie posiada prawidłowej nazwy (np. atrybutu) dla "accessibility API". Dopuszczalne opcje to: {{builtAttrs}}'
405+
,"4_1_2_msg_pattern_role_of_button" : 'element ma rolę "button" ale nie posiada prawidłowej nazwy (np. atrybutu) dla "accessibility API". Dopuszczalne opcje to: {{builtAttrs}}'
406406
,"4_1_2_msg_pattern2" : '{{msgNodeType}} nie ma wartości, która mogłaby być dostępna dla "accessibility API".'
407407
,"4_1_2_msg_add_one" : 'Add one by adding content to the element.'
408408
,"4_1_2_msg_pattern3" : 'This {{msgNodeType}} does not have an initially selected option. Depending on your HTML version, the value exposed to an accessibility API may be undefined.'

0 commit comments

Comments
 (0)