Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Unified Diff: ui/webui/resources/js/local_strings.js

Issue 599653003: Remove old template html boilerplate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bydefault
Patch Set: fix android Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/webui/resources/js/i18n_template.js ('k') | ui/webui/resources/webui_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/js/local_strings.js
diff --git a/ui/webui/resources/js/local_strings.js b/ui/webui/resources/js/local_strings.js
deleted file mode 100644
index e4f9259c5f733717d45bddb90808621714358e60..0000000000000000000000000000000000000000
--- a/ui/webui/resources/js/local_strings.js
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * NOTE: The use of this file is deprecated. Use load_time_data.js instead.
- *
- * The local strings get injected into the page using a variable named
- * {@code templateData}. This class provides a simpler interface to access those
- * strings.
- *
- * @param {Object=} opt_templateData Object containing translated strings. If
- * this is not supplied during construction, it can be assigned to the
- * templateData property after construction. If all else fails, the value
- * of window.templateDate will be used.
-
- * @constructor
- */
-function LocalStrings(opt_templateData) {
- this.templateData = opt_templateData;
-}
-
-// Start of anonymous namespace.
-(function() {
-
-/**
- * Returns a formatted string where $1 to $9 are replaced by the second to the
- * tenth argument.
- * @param {string} s The format string.
- * @param {Arguments} args The extra values to include in the formatted
- * output.
- * @return {string} The string after format substitution.
- */
-function replaceArgs(s, args) {
- return s.replace(/\$[$1-9]/g, function(m) {
- return (m == '$$') ? '$' : args[m[1]];
- });
-}
-
-/**
- * Returns a string after removing Windows-style accelerators.
- * @param {string} s The input string that may contain accelerators.
- * @return {string} The resulting string with accelerators removed.
- */
-function trimAccelerators(s) {
- return s.replace(/&{1,2}/g, function(m) {
- return (m == '&&') ? '&' : '';
- });
-}
-
-LocalStrings.prototype = {
- /**
- * The template data object.
- * @type {Object|undefined}
- */
- templateData: undefined,
-
- /**
- * Gets a localized string by its id.
- * @param {string} id The ID of the string we want.
- * @return {string} The localized string.
- */
- getString: function(id) {
- // TODO(arv): We should not rely on a global variable here.
- var templateData = this.templateData || window.templateData;
- var str = templateData[id];
- // TODO(jhawkins): Change to console.error when all errors are fixed.
- if (!str)
- console.warn('Missing string for id: ' + id);
- return str;
- },
-
- /**
- * Returns a formatted localized string where $1 to $9 are replaced by the
- * second to the tenth argument.
- * @param {string} id The ID of the string we want.
- * @param {...string} var_args The extra values to include in the formatted
- * output.
- * @return {string} The formatted string.
- */
- getStringF: function(id, var_args) {
- return replaceArgs(this.getString(id), arguments);
- },
-};
-
-// End of anonymous namespace.
-})();
« no previous file with comments | « ui/webui/resources/js/i18n_template.js ('k') | ui/webui/resources/webui_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698