|
51 | 51 | largeTextAA: 'Large or bold text AA', |
52 | 52 | largeTextAAA: 'Large or bold text AAA', |
53 | 53 | nonTextAA: 'Non-text elements AA', |
54 | | - clipboardTextPassed: 'For {contentType}, the selected foreground colour ({foregroundColor}) and background colour ({backgroundColor}) result in a contrast of {contrastValue} for {label}, which corresponds to the required minimum contrast ratio of {requiredContrast}:1.', |
55 | | - clipboardTextFailed: 'For {contentType}, the selected foreground colour ({foregroundColor}) and background colour ({backgroundColor}) result in a contrast of {contrastValue} for {label} instead of the required minimum contrast ratio of {requiredContrast}:1.' |
| 54 | + clipboardTextPassed: "The color combination of forground color $foregroundColor$ and background color $backgroundColor$ has a contrast ratio of $contrastValue$ : 1. The required contrast ratio of $contrastValue$ for level $label$ on $contentType$ is passed.", |
| 55 | + clipboardTextFailed: "The color combination of forground color $foregroundColor$ and background color $backgroundColor$ has a contrast ratio of $contrastValue$ : 1. For level $label$ on $contentType$ a minimum contrast of $requiredContrast$ : 1 is required.", |
| 56 | + |
56 | 57 | } |
57 | 58 | }, |
58 | 59 | de: { |
|
76 | 77 | nonText: 'Nicht-Textbasierte-Inhalte', |
77 | 78 | nonTextLabel: 'Visualisierung für nicht-textbasierte Inhalte', |
78 | 79 | applyButton: 'Übernehmen', |
79 | | - colorAriaLive: 'Die ausgewählte farbe ist', |
| 80 | + colorAriaLive: 'Die ausgewählte Farbe ist', |
80 | 81 | successIconLabel: 'bestanden', |
81 | 82 | failedIconLabel: 'fehlgeschlagen', |
82 | 83 | infoIconLabel: 'Hinweis', |
|
96 | 97 | }, |
97 | 98 | errorMessage: 'Bitte geben Sie einen validen Farbwert ein.', |
98 | 99 | copyMessage: { |
99 | | - regularText: 'regulären Text', |
| 100 | + regularText: 'regulärem Text', |
100 | 101 | largeText: 'großen und fetten Text', |
101 | 102 | nonText: 'nicht-textbasierte-Inhalte', |
102 | 103 | template: 'in Zwischenablage kopiert', |
|
105 | 106 | largeTextAA: 'Großer oder fetter Text AA', |
106 | 107 | largeTextAAA: 'Großer oder fetter Text AAA', |
107 | 108 | nonTextAA: 'Nicht-Textbasierte-Inhalte AA', |
108 | | - clipboardTextPassed: 'Für {contentType} ergibt sich mit der gewählten Vordergrundfarbe ({foregroundColor}) und Hintergrundfarbe ({backgroundColor}) ein Kontrast von {contrastValue} für {label}, was dem geforderten Mindestkontrastverhältnis von {requiredContrast}:1 entspricht.', |
109 | | - clipboardTextFailed: 'Für {contentType} ergibt sich mit der gewählten Vordergrundfarbe ({foregroundColor}) und Hintergrundfarbe ({backgroundColor}) ein Kontrast von {contrastValue} für {label}, anstelle des geforderten Mindestkontrastverhältnis von {requiredContrast}:1.' |
| 109 | + clipboardTextPassed: "Die Farbkombination aus Vordergrundfarbe $foregroundColor$ und Hintergrundfarbe $backgroundColor$ hat ein Kontrastverhältnis von $contrastValue$ : 1. Das erforderliche Kontrastverhältnis von mindestens $requiredContrast$ : 1 für Level $label$ bei $contentType$ ist damit erfüllt.", |
| 110 | + clipboardTextFailed: "Die Farbkombination aus Vordergrundfarbe $foregroundColor$ und Hintergrundfarbe $backgroundColor$ hat ein Kontrastverhältnis von $contrastValue$ : 1. Für Level $label$ ist bei $contentType$ ein Kontrastverhältnis von mindestens $requiredContrast$ : 1 erforderlich.", |
110 | 111 | } |
111 | 112 | } |
112 | 113 | }; |
113 | | - |
| 114 | +console.log(translationDictionary); |
114 | 115 | // default color values |
115 | 116 | const defaultForegroundColor = '#323130'; |
116 | 117 | const defaultBackgroundColor = '#cdece8'; |
|
1087 | 1088 | level: level, |
1088 | 1089 | requiredContrast: requiredRatio |
1089 | 1090 | } |
1090 | | - const clipboardText = currentContrastRatio >= requiredRatio ? translations.copyMessage.clipboardTextPassed.replace(/{(.*?)}/g, (_, key) => copyTemplateData[key] || '') : translations.copyMessage.clipboardTextFailed.replace(/{(.*?)}/g, (_, key) => copyTemplateData[key] || ''); |
1091 | | - |
| 1091 | + const clipboardText = |
| 1092 | + currentContrastRatio >= (typeof(requiredRatio) === "string" ? parseFloat(requiredRatio.replace(",", ".")) : requiredRatio) |
| 1093 | + ? translations.copyMessage.clipboardTextPassed.replace(/\$(.*?)\$/g, (_, key) => copyTemplateData[key] || '') |
| 1094 | + : translations.copyMessage.clipboardTextFailed.replace(/\$(.*?)\$/g, (_, key) => copyTemplateData[key] || ''); |
1092 | 1095 | const button = event.currentTarget; |
1093 | 1096 | const textToCopy = button.getAttribute('data-text'); |
1094 | 1097 |
|
|
0 commit comments