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

Unified Diff: chrome/browser/resources/chromeos/chromevox/chromevox/background/options.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
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/chromevox/messages/msgs.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/chromeos/chromevox/chromevox/background/options.js
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.js b/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.js
index 48684376a60a1760693e23dcee1d28ed119defbc..8ba469e2102b9e8522f074a1764915284b757576 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.js
@@ -365,32 +365,26 @@ cvox.OptionsPage.populateBrailleTablesSelect = function() {
return;
}
var tables = cvox.OptionsPage.brailleTables;
- var localeDict = JSON.parse(cvox.ChromeVox.msgs.getMsg('locale_dict'));
var populateSelect = function(node, dots) {
- var localeCount = [];
var activeTable = localStorage[node.id] || localStorage['brailleTable'];
+ // Gather the display names and sort them according to locale.
+ var items = [];
for (var i = 0, table; table = tables[i]; i++) {
if (table.dots !== dots) {
continue;
}
- var item = document.createElement('option');
- item.id = table.id;
- if (!localeCount[table.locale]) {
- localeCount[table.locale] = 0;
- }
- localeCount[table.locale]++;
- var grade = table.grade;
- if (!grade) {
- item.textContent = localeDict[table.locale];
- } else {
- item.textContent = cvox.ChromeVox.msgs.getMsg(
- 'options_braille_locale_grade',
- [localeDict[table.locale], grade]);
- }
- if (table.id == activeTable) {
- item.setAttribute('selected', '');
+ items.push({id: table.id,
+ name: cvox.BrailleTable.getDisplayName(table)});
+ }
+ items.sort(function(a, b) { return a.name.localeCompare(b.name);});
+ for (var i = 0, item; item = items[i]; ++i) {
+ var elem = document.createElement('option');
+ elem.id = item.id;
+ elem.textContent = item.name;
+ if (item.id == activeTable) {
+ elem.setAttribute('selected', '');
}
- node.appendChild(item);
+ node.appendChild(elem);
}
};
var select6 = $('brailleTable6');
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/chromevox/messages/msgs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698