Bug 1043896 - Use proper plural form for highlightOutputConfirm. r=pbrosset r=jwalker

This commit is contained in:
Vikneshwar 2014-10-16 09:28:00 +02:00
parent 0e41b5f81c
commit 6f663b1cbb
3 changed files with 14 additions and 9 deletions

View File

@ -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'
}
},
{

View File

@ -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,

View File

@ -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]);