Title: [266622] trunk/Source/WebInspectorUI
Revision
266622
Author
nvasil...@apple.com
Date
2020-09-04 11:23:01 -0700 (Fri, 04 Sep 2020)

Log Message

Web Inspector: Localization: "Low/Medium/High" strings need separate keys for different uses in the UI
https://bugs.webkit.org/show_bug.cgi?id=216136

Reviewed by Brian Burg.

Provide enough context to understand what nouns "low/medium/high" are used with
("impact" and "priority", in our case). This is necessary to determine adjectives'
grammatical gender.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Models/Resource.js:
(WI.Resource.displayNameForPriority):

* UserInterface/Views/CPUTimelineView.js:
(WI.CPUTimelineView.prototype._layoutEnergyChart):
Drive-by: merge two if blocks into one to minimize code repetition.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (266621 => 266622)


--- trunk/Source/WebInspectorUI/ChangeLog	2020-09-04 18:06:25 UTC (rev 266621)
+++ trunk/Source/WebInspectorUI/ChangeLog	2020-09-04 18:23:01 UTC (rev 266622)
@@ -1,3 +1,22 @@
+2020-09-04  Nikita Vasilyev  <nvasil...@apple.com>
+
+        Web Inspector: Localization: "Low/Medium/High" strings need separate keys for different uses in the UI
+        https://bugs.webkit.org/show_bug.cgi?id=216136
+
+        Reviewed by Brian Burg.
+
+        Provide enough context to understand what nouns "low/medium/high" are used with
+        ("impact" and "priority", in our case). This is necessary to determine adjectives'
+        grammatical gender.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * UserInterface/Models/Resource.js:
+        (WI.Resource.displayNameForPriority):
+
+        * UserInterface/Views/CPUTimelineView.js:
+        (WI.CPUTimelineView.prototype._layoutEnergyChart):
+        Drive-by: merge two if blocks into one to minimize code repetition.
+
 2020-09-04  Patrick Angle  <pan...@apple.com>
 
         Web Inspector: Localization: typo in WAI-ARIA string ("[the] element have")

Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (266621 => 266622)


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2020-09-04 18:06:25 UTC (rev 266621)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2020-09-04 18:23:01 UTC (rev 266622)
@@ -681,7 +681,10 @@
 localizedStrings["Hide transparency grid"] = "Hide transparency grid";
 localizedStrings["Hide type information"] = "Hide type information";
 localizedStrings["Hierarchy Level"] = "Hierarchy Level";
-localizedStrings["High"] = "High";
+/* High network request priority */
+localizedStrings["High @ Network Priority"] = "High";
+/* Energy Impact: High */
+localizedStrings["High @ Timeline Energy Impact"] = "High";
 localizedStrings["Highest: %s"] = "Highest: %s";
 localizedStrings["Host"] = "Host";
 localizedStrings["ICO"] = "ICO";
@@ -792,7 +795,10 @@
 localizedStrings["Log WebSocket"] = "Log WebSocket";
 localizedStrings["Log: "] = "Log: ";
 localizedStrings["Logs"] = "Logs";
-localizedStrings["Low"] = "Low";
+/* Low network request priority */
+localizedStrings["Low @ Network Priority"] = "Low";
+/* Energy Impact: Low */
+localizedStrings["Low @ Timeline Energy Impact"] = "Low";
 localizedStrings["Lowest: %s"] = "Lowest: %s";
 localizedStrings["MIME Type"] = "MIME Type";
 localizedStrings["MIME Type:"] = "MIME Type:";
@@ -813,7 +819,10 @@
 localizedStrings["Media Event"] = "Media Event";
 localizedStrings["Media Logging:"] = "Media Logging:";
 localizedStrings["MediaSource"] = "MediaSource";
-localizedStrings["Medium"] = "Medium";
+/* Medium network request priority */
+localizedStrings["Medium @ Network Priority"] = "Medium";
+/* Energy Impact: Medium */
+localizedStrings["Medium @ Timeline Energy Impact"] = "Medium";
 localizedStrings["Memory"] = "Memory";
 localizedStrings["Memory Cache"] = "Memory Cache";
 localizedStrings["Memory usage of this canvas"] = "Memory usage of this canvas";
@@ -1416,7 +1425,8 @@
 localizedStrings["Vertex"] = "Vertex";
 localizedStrings["Vertex Shader"] = "Vertex Shader";
 localizedStrings["Vertex/Fragment Shader"] = "Vertex/Fragment Shader";
-localizedStrings["Very High"] = "Very High";
+/* Energy Impact: Very High */
+localizedStrings["Very High @ Timeline Energy Impact"] = "Very High";
 localizedStrings["View Image"] = "View Image";
 localizedStrings["View Recording"] = "View Recording";
 localizedStrings["View Shader"] = "View Shader";

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js (266621 => 266622)


--- trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js	2020-09-04 18:06:25 UTC (rev 266621)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js	2020-09-04 18:23:01 UTC (rev 266622)
@@ -239,11 +239,11 @@
     {
         switch (priority) {
         case WI.Resource.NetworkPriority.Low:
-            return WI.UIString("Low");
+            return WI.UIString("Low", "Low @ Network Priority", "Low network request priority");
         case WI.Resource.NetworkPriority.Medium:
-            return WI.UIString("Medium");
+            return WI.UIString("Medium", "Medium @ Network Priority", "Medium network request priority");
         case WI.Resource.NetworkPriority.High:
-            return WI.UIString("High");
+            return WI.UIString("High", "High @ Network Priority", "High network request priority");
         default:
             return null;
         }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CPUTimelineView.js (266621 => 266622)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CPUTimelineView.js	2020-09-04 18:06:25 UTC (rev 266621)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CPUTimelineView.js	2020-09-04 18:23:01 UTC (rev 266622)
@@ -1104,29 +1104,24 @@
 
         this._clearEnergyImpactText();
 
-        if (average === 0) {
-             // Zero. (0% CPU, mapped to 0)
-            this._energyImpactLabelElement.textContent = WI.UIString("Low");
-            this._energyImpactLabelElement.classList.add("low");
-            this._energyChart.value = 0;
-        } else if (average <= CPUTimelineView.lowEnergyThreshold) {
+        if (average <= CPUTimelineView.lowEnergyThreshold) {
             // Low. (<=3% CPU, mapped to 0-10)
-            this._energyImpactLabelElement.textContent = WI.UIString("Low");
+            this._energyImpactLabelElement.textContent = WI.UIString("Low", "Low @ Timeline Energy Impact", "Energy Impact: Low");
             this._energyImpactLabelElement.classList.add("low");
             this._energyChart.value = mapWithBias(average, 0, CPUTimelineView.lowEnergyThreshold, 0, CPUTimelineView.lowEnergyGraphBoundary, 0.85);
         } else if (average <= CPUTimelineView. mediumEnergyThreshold) {
             // Medium (3%-30% CPU, mapped to 10-70)
-            this._energyImpactLabelElement.textContent = WI.UIString("Medium");
+            this._energyImpactLabelElement.textContent = WI.UIString("Medium", "Medium @ Timeline Energy Impact", "Energy Impact: Medium")
             this._energyImpactLabelElement.classList.add("medium");
             this._energyChart.value = mapWithBias(average, CPUTimelineView.lowEnergyThreshold, CPUTimelineView.mediumEnergyThreshold, CPUTimelineView.lowEnergyGraphBoundary, CPUTimelineView.mediumEnergyGraphBoundary, 0.6);
         } else if (average < CPUTimelineView. highEnergyThreshold) {
             // High. (30%-100% CPU, mapped to 70-100)
-            this._energyImpactLabelElement.textContent = WI.UIString("High");
+            this._energyImpactLabelElement.textContent = WI.UIString("High", "High @ Timeline Energy Impact", "Energy Impact: High")
             this._energyImpactLabelElement.classList.add("high");
             this._energyChart.value = mapWithBias(average, CPUTimelineView.mediumEnergyThreshold, CPUTimelineView.highEnergyThreshold, CPUTimelineView.mediumEnergyGraphBoundary, CPUTimelineView.highEnergyGraphBoundary, 0.9);
         } else {
             // Very High. (>100% CPU, mapped to 100)
-            this._energyImpactLabelElement.textContent = WI.UIString("Very High");
+            this._energyImpactLabelElement.textContent = WI.UIString("Very High", "Very High @ Timeline Energy Impact", "Energy Impact: Very High")
             this._energyImpactLabelElement.classList.add("high");
             this._energyChart.value = 100;
         }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to