Skip to content

Commit

Permalink
Remove deprecated Swift macro
Browse files Browse the repository at this point in the history
  • Loading branch information
david-swift committed Apr 3, 2024
1 parent 3b5837a commit 8135771
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 175 deletions.
25 changes: 2 additions & 23 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ let package = Package(
)
],
dependencies: [
.package(url: "https://github.com/apple/swift-syntax", from: "509.0.0"),
.package(url: "https://github.com/jpsim/Yams", from: "5.0.6"),
.package(url: "https://github.com/stackotter/swift-macro-toolkit", from: "0.3.1")
.package(url: "https://github.com/jpsim/Yams", from: "5.0.6")
],
targets: [
.target(
Expand All @@ -41,15 +39,6 @@ let package = Package(
"GenerationLibrary"
]
),
.macro(
name: "LocalizedMacros",
dependencies: [
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "MacroToolkit", package: "swift-macro-toolkit"),
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
"GenerationLibrary"
]
),
.plugin(
name: "GenerateLocalized",
capability: .buildTool(),
Expand All @@ -58,17 +47,7 @@ let package = Package(
]
),
.target(
name: "Localized",
dependencies: [
"LocalizedMacros"
]
),
.executableTarget(
name: "MacroTests",
dependencies: [
"Localized"
],
path: "Tests/MacroTests"
name: "Localized"
),
.executableTarget(
name: "PluginTests",
Expand Down
25 changes: 0 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,31 +99,6 @@ to the target in the `Package.swift` file.
)
```

<details>

<summary> Use the Swift macro alternatively </summary>

If you don't want to have a separate `Localized.yml` resource, you can use the
YML syntax directly in your Swift code using a Swift macro.
Leave out the `resources` and `plugins` lines in the target definition, and
instead of creating a `Localized.yml` file, use the following macro in a Swift file.

```swift
#localized(default: "en", yml: """
export:
en: Export Document
de: Exportiere das Dokument
send(message, name):
en: Send (message) to (name).
de: Sende (message) to (name).
""")
```

You cannot have a `defaultLanguage` set in the YML, instead, use the macro parameter.

</details>

### Usage

In most cases, you want to get the translated string in the system language.
Expand Down
13 changes: 0 additions & 13 deletions Sources/Localized/Localized.swift

This file was deleted.

51 changes: 0 additions & 51 deletions Sources/LocalizedMacros/LocalizedMacro.swift

This file was deleted.

20 changes: 0 additions & 20 deletions Sources/LocalizedMacros/LocalizedPlugin.swift

This file was deleted.

43 changes: 0 additions & 43 deletions Tests/MacroTests/Tests.swift

This file was deleted.

0 comments on commit 8135771

Please sign in to comment.