From 6f663b1cbb075ad08a9b29b11d689e93bdfee689 Mon Sep 17 00:00:00 2001 From: Vikneshwar Date: Thu, 16 Oct 2014 09:28:00 +0200 Subject: [PATCH] Bug 1043896 - Use proper plural form for highlightOutputConfirm. r=pbrosset r=jwalker --- .../commandline/test/browser_cmd_highlight_01.js | 12 ++++++------ .../chrome/browser/devtools/gclicommands.properties | 2 +- toolkit/devtools/gcli/commands/highlight.js | 9 +++++++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/browser/devtools/commandline/test/browser_cmd_highlight_01.js b/browser/devtools/commandline/test/browser_cmd_highlight_01.js index 6c8e85afe74..a29fd8181df 100644 --- a/browser/devtools/commandline/test/browser_cmd_highlight_01.js +++ b/browser/devtools/commandline/test/browser_cmd_highlight_01.js @@ -54,7 +54,7 @@ function* spawnTest() { status: 'VALID' }, exec: { - output: '1 nodes highlighted' + output: '1 node highlighted' } }, { @@ -78,7 +78,7 @@ function* spawnTest() { status: 'VALID' }, exec: { - output: '1 nodes highlighted' + output: '1 node highlighted' } }, { @@ -102,7 +102,7 @@ function* spawnTest() { status: 'VALID' }, exec: { - output: '1 nodes highlighted' + output: '1 node highlighted' } }, { @@ -126,7 +126,7 @@ function* spawnTest() { status: 'VALID' }, exec: { - output: '1 nodes highlighted' + output: '1 node highlighted' } }, { @@ -198,7 +198,7 @@ function* spawnTest() { status: 'VALID' }, exec: { - output: '1 nodes highlighted' + output: '1 node highlighted' } }, { @@ -213,7 +213,7 @@ function* spawnTest() { status: 'VALID' }, exec: { - output: '1 nodes highlighted' + output: '1 node highlighted' } }, { diff --git a/browser/locales/en-US/chrome/browser/devtools/gclicommands.properties b/browser/locales/en-US/chrome/browser/devtools/gclicommands.properties index f883b3e0393..c2e12f76b62 100644 --- a/browser/locales/en-US/chrome/browser/devtools/gclicommands.properties +++ b/browser/locales/en-US/chrome/browser/devtools/gclicommands.properties @@ -220,7 +220,7 @@ highlightKeepManual=By default, existing highlighters are hidden when running th # 'highlight' command, displayed to the user once the command has been entered, # informing the user how many nodes have been highlighted successfully and how # to turn highlighting off -highlightOutputConfirm=%1$S nodes highlighted +highlightOutputConfirm2=%1$S node highlighted;%1$S nodes highlighted # LOCALIZATION NOTE (highlightOutputMaxReached) A confirmation message for the # 'highlight' command, displayed to the user once the command has been entered, diff --git a/toolkit/devtools/gcli/commands/highlight.js b/toolkit/devtools/gcli/commands/highlight.js index 109db141744..32c99591356 100644 --- a/toolkit/devtools/gcli/commands/highlight.js +++ b/toolkit/devtools/gcli/commands/highlight.js @@ -9,6 +9,10 @@ const gcli = require("gcli/index"); require("devtools/server/actors/inspector"); const {HIGHLIGHTER_CLASSES} = require("devtools/server/actors/highlighter"); const {BoxModelHighlighter} = HIGHLIGHTER_CLASSES; +XPCOMUtils.defineLazyGetter(this, "nodesSelected", function() { + return Services.strings.createBundle("chrome://browser/locale/devtools/gclicommands.properties"); +}); +XPCOMUtils.defineLazyModuleGetter(this, "PluralForm","resource://gre/modules/PluralForm.jsm"); // How many maximum nodes can be highlighted in parallel const MAX_HIGHLIGHTED_ELEMENTS = 100; @@ -125,8 +129,9 @@ exports.items = [ i ++; } - let output = gcli.lookupFormat("highlightOutputConfirm", - ["" + args.selector.length]); + let highlightText = nodesSelected.GetStringFromName("highlightOutputConfirm2"); + let output = PluralForm.get(args.selector.length, highlightText) + .replace("%1$S", args.selector.length); if (args.selector.length > i) { output = gcli.lookupFormat("highlightOutputMaxReached", ["" + args.selector.length, "" + i]);