This commit is contained in:
Ray Lothian 2020-09-28 16:02:45 +02:00
parent fa8ff3c95c
commit f9214d27fb
5 changed files with 30 additions and 5 deletions

View file

@ -70,6 +70,9 @@
"exportSettings": { "exportSettings": {
"message": "Export Settings" "message": "Export Settings"
}, },
"exportSettingsTitle": {
"message": "To generate minified version, press Shift key while pressing this button"
},
"help": { "help": {
"message": "FAQs Page (Help)" "message": "FAQs Page (Help)"
}, },
@ -172,6 +175,15 @@
"uaPlaceholder": { "uaPlaceholder": {
"message": "Your preferred user-agent string" "message": "Your preferred user-agent string"
}, },
"ztoa": {
"message": "Z to A"
},
"atoz": {
"message": "A to Z"
},
"filterAmong": {
"message": "Filter among $1"
},
"msgDefaultUA": { "msgDefaultUA": {
"message": "Default UA, press the reset button instead" "message": "Default UA, press the reset button instead"
}, },

View file

@ -66,7 +66,7 @@
<div class="admin" data-localize="managedStorage">This extension supports managed storage. All the preferences can be pre-configured by the domain administrator</div> <div class="admin" data-localize="managedStorage">This extension supports managed storage. All the preferences can be pre-configured by the domain administrator</div>
<div id="backup"> <div id="backup">
<button id="import" data-localize="importSettings">Import Settings</button> <button id="import" data-localize="importSettings">Import Settings</button>
<button title="to generate minified version, press Shift key while pressing this button" id="export" data-localize="exportSettings">Export Settings</button> <button data-localized-title="exportSettingsTitle" title="To generate minified version, press Shift key while pressing this button" id="export" data-localize="exportSettings">Export Settings</button>
</div> </div>
<div id="tools"> <div id="tools">
<button id="help" data-localize="help">FAQs Page (Help)</button> <button id="help" data-localize="help">FAQs Page (Help)</button>

View file

@ -8,6 +8,13 @@ document.querySelectorAll('[data-localize]').forEach(e => {
e.textContent = translated; e.textContent = translated;
} }
}); });
document.querySelectorAll('[data-localized-title]').forEach(e => {
const ref = e.dataset.localizedTitle;
const translated = chrome.i18n.getMessage(ref);
if (translated) {
e.title = translated;
}
});
function notify(msg, period = 750) { function notify(msg, period = 750) {
// Update status to let user know options were saved. // Update status to let user know options were saved.

View file

@ -40,8 +40,8 @@
<th> <th>
<input type="search" id="custom" placeholder="Filter items">&nbsp; <input type="search" id="custom" placeholder="Filter items">&nbsp;
<select id="sort"> <select id="sort">
<option value="descending">Z to A</option> <option value="descending" data-localize="ztoa">Z to A</option>
<option value="ascending">A to Z</option> <option value="ascending" data-localize="atoz">A to Z</option>
</select> </select>
</th> </th>
</tr> </tr>

View file

@ -8,7 +8,6 @@ document.querySelectorAll('[data-localized-value]').forEach(e => {
e.value = translated; e.value = translated;
} }
}); });
document.querySelectorAll('[data-localized-title]').forEach(e => { document.querySelectorAll('[data-localized-title]').forEach(e => {
const ref = e.dataset.localizedTitle; const ref = e.dataset.localizedTitle;
const translated = chrome.i18n.getMessage(ref); const translated = chrome.i18n.getMessage(ref);
@ -16,6 +15,13 @@ document.querySelectorAll('[data-localized-title]').forEach(e => {
e.title = translated; e.title = translated;
} }
}); });
document.querySelectorAll('[data-localize]').forEach(e => {
const ref = e.dataset.localize;
const translated = chrome.i18n.getMessage(ref);
if (translated) {
e.textContent = translated;
}
});
const DCSI = 'firefox-default'; const DCSI = 'firefox-default';
@ -155,7 +161,7 @@ function update(ua) {
inline: 'nearest' inline: 'nearest'
}); });
} }
document.getElementById('custom').placeholder = `Filter among ${list.length}`; document.getElementById('custom').placeholder = chrome.i18n.getMessage('filterAmong', [list.length]);
[...document.getElementById('os').querySelectorAll('option')].forEach(option => { [...document.getElementById('os').querySelectorAll('option')].forEach(option => {
option.disabled = (map.matching[browser.toLowerCase()] || []).indexOf(option.value.toLowerCase()) === -1; option.disabled = (map.matching[browser.toLowerCase()] || []).indexOf(option.value.toLowerCase()) === -1;
}); });