Skip to content

Commit 76d6aae

Browse files
committed
fix: use stringUtils to replace strings
1 parent 3dc6e1d commit 76d6aae

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/extensionsIntegrated/CustomSnippets/UIHelper.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
/* eslint-disable no-invalid-this */
2222
define(function (require, exports, module) {
23+
const StringUtils = require("utils/StringUtils");
2324
const Global = require("./global");
2425
const Strings = require("strings");
2526

@@ -188,7 +189,7 @@ define(function (require, exports, module) {
188189
const wrapperId = isEditForm ? "edit-abbr-box-wrapper" : "abbr-box-wrapper";
189190
const errorId = isEditForm ? "edit-abbreviation-duplicate-error" : "abbreviation-duplicate-error";
190191

191-
showError(inputId, wrapperId, Strings.CUSTOM_SNIPPETS_DUPLICATE_ERROR.replace("{0}", abbreviation), errorId);
192+
showError(inputId, wrapperId, StringUtils.format(Strings.CUSTOM_SNIPPETS_DUPLICATE_ERROR, abbreviation), errorId);
192193
}
193194

194195
/**

src/extensionsIntegrated/CustomSnippets/snippetsList.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
/* eslint-disable no-invalid-this */
2727
define(function (require, exports, module) {
28+
const StringUtils = require("utils/StringUtils");
2829
const Metrics = require("utils/Metrics");
2930

3031
const Global = require("./global");
@@ -48,12 +49,12 @@ define(function (require, exports, module) {
4849
const $snippetAbbr = $("<div>")
4950
.text(snippetItem.abbreviation)
5051
.attr("id", "snippet-abbr")
51-
.attr("title", Strings.CUSTOM_SNIPPETS_EDIT_ABBR_TOOLTIP.replace("{0}", snippetItem.abbreviation));
52+
.attr("title", StringUtils.format(Strings.CUSTOM_SNIPPETS_EDIT_ABBR_TOOLTIP, snippetItem.abbreviation));
5253

5354
const $snippetTemplate = $("<div>")
5455
.text(snippetItem.templateText)
5556
.attr("id", "snippet-template")
56-
.attr("title", Strings.CUSTOM_SNIPPETS_EDIT_TEMPLATE_TOOLTIP.replace("{0}", snippetItem.templateText));
57+
.attr("title", StringUtils.format(Strings.CUSTOM_SNIPPETS_EDIT_TEMPLATE_TOOLTIP, snippetItem.templateText));
5758

5859
const $snippetDescription = $("<div>")
5960
.text(
@@ -65,14 +66,14 @@ define(function (require, exports, module) {
6566
.attr(
6667
"title",
6768
snippetItem.description && snippetItem.description.trim() !== ""
68-
? Strings.CUSTOM_SNIPPETS_EDIT_DESC_TOOLTIP.replace("{0}", snippetItem.description)
69+
? StringUtils.format(Strings.CUSTOM_SNIPPETS_EDIT_DESC_TOOLTIP, snippetItem.description)
6970
: Strings.CUSTOM_SNIPPETS_ADD_DESC_TOOLTIP
7071
);
7172

7273
const $snippetFiles = $("<div>")
7374
.text(snippetItem.fileExtension || "all")
7475
.attr("id", "snippet-files")
75-
.attr("title", Strings.CUSTOM_SNIPPETS_EDIT_FILE_EXT_TOOLTIP.replace("{0}", snippetItem.fileExtension || "all"));
76+
.attr("title", StringUtils.format(Strings.CUSTOM_SNIPPETS_EDIT_FILE_EXT_TOOLTIP, snippetItem.fileExtension || "all"));
7677

7778
const $deleteSnippet = $("<div>")
7879
.html(`<i class="fas fa-trash"></i>`)
@@ -105,7 +106,7 @@ define(function (require, exports, module) {
105106
const filterText = $filterInput.val().trim();
106107

107108
if (filterText) {
108-
$emptyMessage.text(Strings.CUSTOM_SNIPPETS_NO_MATCHES.replace("{0}", filterText));
109+
$emptyMessage.text(StringUtils.format(Strings.CUSTOM_SNIPPETS_NO_MATCHES, filterText));
109110
} else {
110111
$emptyMessage.html(Strings.CUSTOM_SNIPPETS_LEARN_MORE);
111112
}

0 commit comments

Comments
 (0)