mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-20 23:58:08 +03:00
Restore “Restore Defaults” button in syntax editor
This commit is contained in:
parent
696f4fe72e
commit
49039f52b7
@ -157,6 +157,11 @@ struct SyntaxEditView: View {
|
|||||||
Divider()
|
Divider()
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
|
if self.isBundled {
|
||||||
|
Button(String(localized: "Restore Defaults", table: "SyntaxEdit")) {
|
||||||
|
self.restore()
|
||||||
|
}.fixedSize()
|
||||||
|
}
|
||||||
Spacer()
|
Spacer()
|
||||||
SubmitButtonGroup(action: self.submit) {
|
SubmitButtonGroup(action: self.submit) {
|
||||||
self.parent?.dismiss(nil)
|
self.parent?.dismiss(nil)
|
||||||
@ -243,6 +248,19 @@ struct SyntaxEditView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Restores the current settings in editor to the user default.
|
||||||
|
private func restore() {
|
||||||
|
|
||||||
|
guard
|
||||||
|
self.isBundled,
|
||||||
|
let definition = SyntaxManager.shared.bundledDefinition(name: self.name)
|
||||||
|
else { return }
|
||||||
|
|
||||||
|
self.syntax.update(with: definition)
|
||||||
|
self.errors = self.syntax.validate()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Validates the passed-in syntax name.
|
/// Validates the passed-in syntax name.
|
||||||
///
|
///
|
||||||
/// - Parameter name: The syntax name to test.
|
/// - Parameter name: The syntax name to test.
|
||||||
|
@ -2973,6 +2973,76 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Restore Defaults" : {
|
||||||
|
"localizations" : {
|
||||||
|
"cs" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Výchozí hodnoty"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"de" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Standard wiederherstellen"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"en-GB" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Restore Defaults"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"es" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Restaurar valores por omisión"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"fr" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Réglages par défaut"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"it" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Ripristina default"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ja" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "デフォルトに戻す"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pt" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Restaurar Padrões"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tr" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Saptanmışlara Dön"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-Hans" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "恢复默认"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-Hant" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "回復預設值"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Syntax.key.attributes.label" : {
|
"Syntax.key.attributes.label" : {
|
||||||
"comment" : "syntax highlight type",
|
"comment" : "syntax highlight type",
|
||||||
"extractionState" : "extracted_with_value",
|
"extractionState" : "extracted_with_value",
|
||||||
|
Loading…
Reference in New Issue
Block a user