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

Unified Diff: remoting/webapp/me2mom/l10n.js

Issue 9148043: Rename webapp_it2me to remoting_webapp and move it from webapp/me2mom to webapp/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add webapp_it2me back Created 8 years, 11 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 | « remoting/webapp/me2mom/host_table_entry.js ('k') | remoting/webapp/me2mom/log_to_server.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/me2mom/l10n.js
diff --git a/remoting/webapp/me2mom/l10n.js b/remoting/webapp/me2mom/l10n.js
deleted file mode 100644
index 487d1c00e7a8bba8b616ef9b9c0af7e427252db6..0000000000000000000000000000000000000000
--- a/remoting/webapp/me2mom/l10n.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Copyright (c) 2011 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.
- */
-
-var l10n = l10n || {};
-
-/**
- * Localize an element by setting its innerText according to the specified tag
- * and an optional set of substitutions.
- * @param {Element} element The element to localize.
- * @param {string} tag The localization tag.
- * @param {(string|Array)=} opt_substitutions An optional set of substitution
- * strings corresponding to the "placeholders" attributes in messages.json.
- * @return {boolean} True if the localization was successful; false otherwise.
- */
-l10n.localizeElementFromTag = function(element, tag, opt_substitutions) {
- var translation = chrome.i18n.getMessage(tag, opt_substitutions);
- if (translation) {
- element.innerHTML = translation;
- } else {
- console.error('Missing translation for "' + tag + '":', element);
- }
- return translation != null;
-};
-
-/**
- * Localize an element by setting its innerText according to its i18n-content
- * attribute, and an optional set of substitutions.
- * @param {Element} element The element to localize.
- * @param {(string|Array)=} opt_substitutions An optional set of substitution
- * strings corresponding to the "placeholders" attributes in messages.json.
- * @return {boolean} True if the localization was successful; false otherwise.
- */
-l10n.localizeElement = function(element, opt_substitutions) {
- var tag = element.getAttribute('i18n-content');
- return l10n.localizeElementFromTag(element, tag, opt_substitutions);
-};
-
-/**
- * Localize all tags with the i18n-content attribute, using i18n-data-n
- * attributes to specify any placeholder substitutions.
- */
-l10n.localize = function() {
- var elements = document.querySelectorAll('[i18n-content]');
- for (var i = 0; i < elements.length; ++i) {
- /** @type {Element} */ var element = elements[i];
- var substitutions = null;
- for (var j = 1; j < 9; ++j) {
- var attr = 'i18n-value-' + j;
- if (element.hasAttribute(attr)) {
- if (!substitutions) {
- substitutions = [];
- }
- substitutions.push(element.getAttribute(attr));
- } else {
- break;
- }
- }
- l10n.localizeElement(element, substitutions);
- }
-};
« no previous file with comments | « remoting/webapp/me2mom/host_table_entry.js ('k') | remoting/webapp/me2mom/log_to_server.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698