Localizable macro
This commit is contained in:
parent
7ee534b69b
commit
c27de77d6c
6 changed files with 315 additions and 1 deletions
23
Sources/LocalizableMacros/LocalizableDiagnostic.swift
Normal file
23
Sources/LocalizableMacros/LocalizableDiagnostic.swift
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import SwiftSyntax
|
||||
import SwiftDiagnostics
|
||||
|
||||
enum LocalizableDiagnostic {
|
||||
case enumRequired
|
||||
}
|
||||
|
||||
extension LocalizableDiagnostic: DiagnosticMessage {
|
||||
var message: String {
|
||||
switch self {
|
||||
case .enumRequired:
|
||||
"The @Localizable macro requires a nested enum with localization keys."
|
||||
}
|
||||
}
|
||||
|
||||
var diagnosticID: MessageID {
|
||||
.init(domain: "LocalizableMacro", id: "\(self)")
|
||||
}
|
||||
|
||||
var severity: DiagnosticSeverity {
|
||||
.error
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue