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

Unified Diff: chrome/browser/resources/chromeos/chromevox/chromevox/messages/msgs.js

Issue 578303002: Add new braille tables supported by liblouis 2.6.0. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@libloiusupgrade
Patch Set: Machines are good at sorting, not me... 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
Index: chrome/browser/resources/chromeos/chromevox/chromevox/messages/msgs.js
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/messages/msgs.js b/chrome/browser/resources/chromeos/chromevox/chromevox/messages/msgs.js
index 41fa7a2968a972d59d1ac580071165735e37a79d..7f726f08c894e050959a2ee8400f035b36b07a7c 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/messages/msgs.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/messages/msgs.js
@@ -13,6 +13,11 @@ goog.provide('cvox.Msgs');
* @constructor
*/
cvox.Msgs = function() {
+ /**
+ * @type {Object.<string, string>}
+ * @private
+ */
+ this.localeNameDict_ = null;
};
@@ -82,3 +87,23 @@ cvox.Msgs.prototype.addTranslatedMessagesToDom = function(root) {
cvox.Msgs.prototype.getNumber = function(num) {
return '' + num;
};
+
+/**
+ * Gets a localized display name for a locale.
+ * NOTE: Only a subset of locale identifiers are supported. See the
+ * |CHROMEVOX_LOCALE_DICT| message.
+ * @param {string} locale On the form |ll| or |ll_CC|, where |ll| is
+ * the language code and |CC| the country code.
+ * @return {string} The display name.
+ */
+cvox.Msgs.prototype.getLocaleDisplayName = function(locale) {
+ if (!this.localeNameDict_) {
+ this.localeNameDict_ = /** @type {Object.<string, string>} */(
+ JSON.parse(this.getMsg('locale_dict')));
+ }
+ var name = this.localeNameDict_[locale];
+ if (!name) {
+ throw Error('Unsupported locale identifier: ' + locale);
+ }
+ return name;
+};

Powered by Google App Engine
This is Rietveld 408576698