Skip to content

Commit

Permalink
Settings panel translation support (async)
Browse files Browse the repository at this point in the history
based on PR 276 by ClawOfDead
  • Loading branch information
wraythex committed Sep 5, 2023
1 parent 4ec8b42 commit a20e8d7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions static/js/map/map.settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1538,7 +1538,7 @@ function initSettingsSidebar() {

$('#settings-file-input').on('change', function () {
function loaded(e) {
const confirmed = confirm('Are you sure you want to import settings?')
const confirmed = confirm(i18n('Are you sure you want to import settings?'))
if (!confirmed) {
return
}
Expand All @@ -1563,15 +1563,15 @@ function initSettingsSidebar() {
})

$('#load-settings-select').on('change', function () {
const confirmed = confirm(`Are you sure you want to load the saved settings "${this.value}" and replace all current ones?`)
const confirmed = confirm(`${i18n('Are you sure you want to load the saved settings')} "${this.value}" ${i18n('and replace all current ones?')}`)
if (confirmed) {
Store.restore(JSON.parse(settings.savedSettings[this.value]))
window.location.reload()
}
})

$('#delete-settings-select').on('change', function () {
const confirmed = confirm(`Are you sure you want to delete the saved settings named "${this.value}"?`)
const confirmed = confirm(`${i18n('Are you sure you want to delete the saved settings named')} "${this.value}"?`)
if (confirmed) {
delete settings.savedSettings[this.value]
Store.set('savedSettings', settings.savedSettings)
Expand All @@ -1580,7 +1580,7 @@ function initSettingsSidebar() {
})

$('#save-settings-button').on('click', function () {
const settingsName = prompt('Please state a name for this set of settings (saved settings with the same name will be overwritten):', 'Setting1')
const settingsName = prompt(i18n('Please state a name for this set of settings (saved settings with the same name will be overwritten):'), 'Setting1')
settings.savedSettings[settingsName.replaceAll(/[^\w-_ ]/gi, '')] = JSON.stringify(Store.dump())
Store.set('savedSettings', settings.savedSettings)
refreshSavedSettings()
Expand All @@ -1591,7 +1591,7 @@ function initSettingsSidebar() {
})

$('#reset-settings-button').on('click', function () {
const confirmed = confirm('Are you sure you want to reset all settings to default values?')
const confirmed = confirm(i18n('Are you sure you want to reset all settings to default values?'))
if (confirmed) {
localStorage.clear()
window.location.reload()
Expand Down

0 comments on commit a20e8d7

Please sign in to comment.