Bug 1340971 - Use proper plural form in editor.searchResults and sourceSearch.resultsSummary1 r=davidwalsh,flod

Added proper plural form to editor.searchResults and sourceSearch.resultsSummary1. Updated the comments and IDs for the new strings as well. Replaced all instances of old string references with new string references.

Differential Revision: https://phabricator.services.mozilla.com/D32881

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Miriam 2019-06-11 19:25:15 +00:00
parent 69d4dbd679
commit 5a1f34625e
9 changed files with 39 additions and 26 deletions

View File

@ -54,7 +54,7 @@
"babel-plugin-transform-imports": "^1.5.0",
"codemirror": "^5.28.0",
"devtools-environment": "^0.0.6",
"devtools-launchpad": "^0.0.154",
"devtools-launchpad": "^0.0.155",
"devtools-linters": "^0.0.4",
"devtools-reps": "0.23.0",
"devtools-source-map": "0.16.0",

View File

@ -38,7 +38,7 @@
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-preset-react": "^6.24.1",
"devtools-config": "^0.0.16",
"devtools-launchpad": "^0.0.154",
"devtools-launchpad": "^0.0.155",
"devtools-license-check": "^0.7.0",
"devtools-modules": "~1.1.0",
"devtools-services": "^0.0.1",

View File

@ -33,6 +33,7 @@ import type { Modifiers, SearchResults } from "../../reducers/file-search";
import SearchInput from "../shared/SearchInput";
import { debounce } from "lodash";
import "./SearchBar.css";
import { PluralForm } from "devtools-modules";
import type SourceEditor from "../../utils/editor/source-editor";
@ -239,10 +240,14 @@ class SearchBar extends Component<Props, State> {
}
if (index == -1) {
return L10N.getFormatStr("sourceSearch.resultsSummary1", count);
const resultsSummaryString = L10N.getStr("sourceSearch.resultsSummary1");
return PluralForm.get(count, resultsSummaryString).replace("#1", count);
}
return L10N.getFormatStr("editor.searchResults", matchIndex + 1, count);
const searchResultsString = L10N.getStr("editor.searchResults1");
return PluralForm.get(count, searchResultsString)
.replace("#1", count)
.replace("%d", matchIndex + 1);
}
renderSearchModifiers = () => {

View File

@ -166,7 +166,7 @@ exports[`showErrorEmoji false if query + results 1`] = `
showClose={false}
showErrorEmoji={false}
size=""
summaryMsg="-NaN of 10 results"
summaryMsg="NaN of 10 results"
/>
<div
className="search-bottom-bar"

View File

@ -31,6 +31,7 @@ import type { List } from "immutable";
import type { ActiveSearchType } from "../reducers/types";
import type { StatusType } from "../reducers/project-text-search";
import type { Context } from "../types";
import { PluralForm } from "devtools-modules";
import "./ProjectSearch.css";
@ -280,9 +281,12 @@ export class ProjectSearch extends Component<Props, State> {
};
renderSummary = () => {
return this.props.query !== ""
? L10N.getFormatStr("sourceSearch.resultsSummary1", this.getResultCount())
: "";
if (this.props.query !== "") {
const resultsSummaryString = L10N.getStr("sourceSearch.resultsSummary2");
const count = this.getResultCount();
return PluralForm.get(count, resultsSummaryString).replace("#1", count);
}
return "";
};
shouldShowErrorEmoji() {

View File

@ -3274,11 +3274,11 @@ devtools-connection@^1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/devtools-connection/-/devtools-connection-1.0.7.tgz#16f23256f842dce339038cdc273c49c473ef83e0"
devtools-contextmenu@~1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/devtools-contextmenu/-/devtools-contextmenu-1.0.7.tgz#dd56353a706c3be4cd06d49d6da6dc5219254c90"
devtools-contextmenu@~1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/devtools-contextmenu/-/devtools-contextmenu-1.0.8.tgz#de57a1afd2324cf48dc251e3e44e3fea1ef9581a"
dependencies:
devtools-modules "~1.1.3"
devtools-modules "~1.1.4"
devtools-environment@^0.0.5:
version "0.0.5"
@ -3288,9 +3288,9 @@ devtools-environment@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/devtools-environment/-/devtools-environment-0.0.6.tgz#11584f5b1ead784c2356d8da647a630fed591a4e"
devtools-launchpad@^0.0.154:
version "0.0.154"
resolved "https://registry.yarnpkg.com/devtools-launchpad/-/devtools-launchpad-0.0.154.tgz#ee408dcae5b5e36eca9eb55338eeaf6920a46bf7"
devtools-launchpad@^0.0.155:
version "0.0.155"
resolved "https://registry.yarnpkg.com/devtools-launchpad/-/devtools-launchpad-0.0.155.tgz#61b8f3b329df761c6fe82ac619a5bec789049fd0"
dependencies:
amd-loader "0.0.8"
autoprefixer "^7.1.2"
@ -3316,11 +3316,11 @@ devtools-launchpad@^0.0.154:
debug "^3.1.0"
devtools-config "^0.0.16"
devtools-connection "^1.0.7"
devtools-contextmenu "~1.0.7"
devtools-contextmenu "~1.0.8"
devtools-environment "^0.0.5"
devtools-license-check "^0.7.0"
devtools-mc-assets "^0.0.7"
devtools-modules "~1.1.3"
devtools-modules "~1.1.4"
devtools-sprintf-js "^1.0.3"
express "^4.13.4"
express-static "^1.2.5"
@ -3408,9 +3408,9 @@ devtools-modules@~1.1.0:
devtools-services "0.0.1"
punycode "^2.1.0"
devtools-modules@~1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/devtools-modules/-/devtools-modules-1.1.3.tgz#4fbeee232263794bd3dd5b314c1a0ae28d76ea6f"
devtools-modules@~1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/devtools-modules/-/devtools-modules-1.1.4.tgz#1a3089118a06225d28572e4890cd6dc0b64308a8"
dependencies:
devtools-services "0.0.1"
punycode "^2.1.0"

View File

@ -317,9 +317,10 @@ sourceSearch.search.again.key3=Cmd+G
# key identifiers, not messages displayed to the user.
sourceSearch.search.againPrev.key3=Cmd+Shift+G
# LOCALIZATION NOTE (sourceSearch.resultsSummary1): Shows a summary of
# the number of matches for autocomplete
sourceSearch.resultsSummary1=%d results
# LOCALIZATION NOTE (sourceSearch.resultsSummary2): Semi-colon list of plural forms.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
# Shows a summary of the number of matches for autocomplete
sourceSearch.resultsSummary2=#1 result;#1 results
# LOCALIZATION NOTE (noMatchingStringsText): The text to display in the
# global search results when there are no matching strings after filtering.
@ -482,9 +483,10 @@ callStack.group.collapseTooltip=Collapse %S frames
# Framework Components pane in the right sidebar.
components.header=Components
# LOCALIZATION NOTE (editor.searchResults): Editor Search bar message
# for the summarizing the selected search result. e.g. 5 of 10 results.
editor.searchResults=%d of %d results
# LOCALIZATION NOTE (editor.searchResults1): Semi-colon list of plural forms.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
# Editor Search bar message to summarize the selected search result. e.g. 5 of 10 results.
editor.searchResults1=%d of #1 result;%d of #1 results
# LOCALIZATION NOTE (editor.singleResult): Copy shown when there is one result.
editor.singleResult=1 result

View File

@ -71,6 +71,7 @@ const VENDORS = [
const moduleMapping = {
Telemetry: "devtools/client/shared/telemetry",
asyncStorage: "devtools/shared/async-storage",
PluralForm: "devtools/shared/plural-form",
};
/*

View File

@ -198,5 +198,6 @@ function log(aMsg)
}
exports.PluralForm = PluralForm;
exports.get = PluralForm.get;
/* eslint-ensable */