Skip to content

Commit 8b83b3f

Browse files
committed
Document category-specific extensions & adjust manifest accordingly
1 parent c953da5 commit 8b83b3f

File tree

2 files changed

+182
-1
lines changed

2 files changed

+182
-1
lines changed

Package.swift

Lines changed: 164 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,181 @@ let package = Package(
66
name: "TranslateKit",
77
defaultLocalization: "en",
88
platforms: [.macOS(.v13), .iOS(.v16), .tvOS(.v16), .watchOS(.v9), .macCatalyst(.v16)],
9-
products: [.library(name: "TranslateKit", targets: ["TranslateKit"])],
9+
products: [
10+
.library(name: "TranslateKit", targets: ["TranslateKit"]),
11+
.library(name: "TranslateKitBooks", targets: ["TranslateKitBooks"]),
12+
.library(name: "TranslateKitBusiness", targets: ["TranslateKitBusiness"]),
13+
.library(name: "TranslateKitDeveloperTools", targets: ["TranslateKitDeveloperTools"]),
14+
.library(name: "TranslateKitEducation", targets: ["TranslateKitEducation"]),
15+
.library(name: "TranslateKitEntertainment", targets: ["TranslateKitEntertainment"]),
16+
.library(name: "TranslateKitFinance", targets: ["TranslateKitFinance"]),
17+
.library(name: "TranslateKitFoodAndDrink", targets: ["TranslateKitFoodAndDrink"]),
18+
.library(name: "TranslateKitGames", targets: ["TranslateKitGames"]),
19+
.library(name: "TranslateKitGraphicsAndDesign", targets: ["TranslateKitGraphicsAndDesign"]),
20+
.library(name: "TranslateKitHealthAndFitness", targets: ["TranslateKitHealthAndFitness"]),
21+
.library(name: "TranslateKitLifestyle", targets: ["TranslateKitLifestyle"]),
22+
.library(name: "TranslateKitMagazines", targets: ["TranslateKitMagazines"]),
23+
.library(name: "TranslateKitMedical", targets: ["TranslateKitMedical"]),
24+
.library(name: "TranslateKitMusic", targets: ["TranslateKitMusic"]),
25+
.library(name: "TranslateKitNavigation", targets: ["TranslateKitNavigation"]),
26+
.library(name: "TranslateKitNews", targets: ["TranslateKitNews"]),
27+
.library(name: "TranslateKitPhotoAndVideo", targets: ["TranslateKitPhotoAndVideo"]),
28+
.library(name: "TranslateKitProductivity", targets: ["TranslateKitProductivity"]),
29+
.library(name: "TranslateKitReference", targets: ["TranslateKitReference"]),
30+
.library(name: "TranslateKitShopping", targets: ["TranslateKitShopping"]),
31+
.library(name: "TranslateKitSocialNetworking", targets: ["TranslateKitSocialNetworking"]),
32+
.library(name: "TranslateKitSports", targets: ["TranslateKitSports"]),
33+
.library(name: "TranslateKitStickers", targets: ["TranslateKitStickers"]),
34+
.library(name: "TranslateKitTravel", targets: ["TranslateKitTravel"]),
35+
.library(name: "TranslateKitUtilities", targets: ["TranslateKitUtilities"]),
36+
.library(name: "TranslateKitWeather", targets: ["TranslateKitWeather"]),
37+
],
1038
dependencies: [
1139
// being a good citizen: https://www.pointfree.co/blog/posts/116-being-a-good-citizen-in-the-land-of-swiftsyntax
1240
.package(url: "https://github.com/apple/swift-syntax.git", "600.0.0"..<"699.99.99"),
1341
.package(url: "https://github.com/pointfreeco/swift-macro-testing.git", branch: "main"),
1442
],
1543
targets: [
44+
// Core Target
1645
.target(
1746
name: "TranslateKit",
1847
dependencies: ["TranslateKitMacros"],
1948
resources: [.process("Localizable.xcstrings")]
2049
),
50+
51+
// Category-specific Targets
52+
.target(
53+
name: "TranslateKitBooks",
54+
dependencies: ["TranslateKit"],
55+
resources: [.process("Localizable.xcstrings")]
56+
),
57+
.target(
58+
name: "TranslateKitBusiness",
59+
dependencies: ["TranslateKit"],
60+
resources: [.process("Localizable.xcstrings")]
61+
),
62+
.target(
63+
name: "TranslateKitDeveloperTools",
64+
dependencies: ["TranslateKit"],
65+
resources: [.process("Localizable.xcstrings")]
66+
),
67+
.target(
68+
name: "TranslateKitEducation",
69+
dependencies: ["TranslateKit"],
70+
resources: [.process("Localizable.xcstrings")]
71+
),
72+
.target(
73+
name: "TranslateKitEntertainment",
74+
dependencies: ["TranslateKit"],
75+
resources: [.process("Localizable.xcstrings")]
76+
),
77+
.target(
78+
name: "TranslateKitFinance",
79+
dependencies: ["TranslateKit"],
80+
resources: [.process("Localizable.xcstrings")]
81+
),
82+
.target(
83+
name: "TranslateKitFoodAndDrink",
84+
dependencies: ["TranslateKit"],
85+
resources: [.process("Localizable.xcstrings")]
86+
),
87+
.target(
88+
name: "TranslateKitGames",
89+
dependencies: ["TranslateKit"],
90+
resources: [.process("Localizable.xcstrings")]
91+
),
92+
.target(
93+
name: "TranslateKitGraphicsAndDesign",
94+
dependencies: ["TranslateKit"],
95+
resources: [.process("Localizable.xcstrings")]
96+
),
97+
.target(
98+
name: "TranslateKitHealthAndFitness",
99+
dependencies: ["TranslateKit"],
100+
resources: [.process("Localizable.xcstrings")]
101+
),
102+
.target(
103+
name: "TranslateKitLifestyle",
104+
dependencies: ["TranslateKit"],
105+
resources: [.process("Localizable.xcstrings")]
106+
),
107+
.target(
108+
name: "TranslateKitMagazines",
109+
dependencies: ["TranslateKit"],
110+
resources: [.process("Localizable.xcstrings")]
111+
),
112+
.target(
113+
name: "TranslateKitMedical",
114+
dependencies: ["TranslateKit"],
115+
resources: [.process("Localizable.xcstrings")]
116+
),
117+
.target(
118+
name: "TranslateKitMusic",
119+
dependencies: ["TranslateKit"],
120+
resources: [.process("Localizable.xcstrings")]
121+
),
122+
.target(
123+
name: "TranslateKitNavigation",
124+
dependencies: ["TranslateKit"],
125+
resources: [.process("Localizable.xcstrings")]
126+
),
127+
.target(
128+
name: "TranslateKitNews",
129+
dependencies: ["TranslateKit"],
130+
resources: [.process("Localizable.xcstrings")]
131+
),
132+
.target(
133+
name: "TranslateKitPhotoAndVideo",
134+
dependencies: ["TranslateKit"],
135+
resources: [.process("Localizable.xcstrings")]
136+
),
137+
.target(
138+
name: "TranslateKitProductivity",
139+
dependencies: ["TranslateKit"],
140+
resources: [.process("Localizable.xcstrings")]
141+
),
142+
.target(
143+
name: "TranslateKitReference",
144+
dependencies: ["TranslateKit"],
145+
resources: [.process("Localizable.xcstrings")]
146+
),
147+
.target(
148+
name: "TranslateKitShopping",
149+
dependencies: ["TranslateKit"],
150+
resources: [.process("Localizable.xcstrings")]
151+
),
152+
.target(
153+
name: "TranslateKitSocialNetworking",
154+
dependencies: ["TranslateKit"],
155+
resources: [.process("Localizable.xcstrings")]
156+
),
157+
.target(
158+
name: "TranslateKitSports",
159+
dependencies: ["TranslateKit"],
160+
resources: [.process("Localizable.xcstrings")]
161+
),
162+
.target(
163+
name: "TranslateKitStickers",
164+
dependencies: ["TranslateKit"],
165+
resources: [.process("Localizable.xcstrings")]
166+
),
167+
.target(
168+
name: "TranslateKitTravel",
169+
dependencies: ["TranslateKit"],
170+
resources: [.process("Localizable.xcstrings")]
171+
),
172+
.target(
173+
name: "TranslateKitUtilities",
174+
dependencies: ["TranslateKit"],
175+
resources: [.process("Localizable.xcstrings")]
176+
),
177+
.target(
178+
name: "TranslateKitWeather",
179+
dependencies: ["TranslateKit"],
180+
resources: [.process("Localizable.xcstrings")]
181+
),
182+
183+
// Support Targets
21184
.macro(
22185
name: "TranslateKitMacros",
23186
dependencies: [

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,24 @@ String Catalogs made it challenging to maintain best practices from the Strings-
5656

5757
You can see in the image what the simple `#tk` macro call expands to, adding an auto-derived key. These semantic keys help group related translations and provide crucial context to translators and translation tools (like the [TranslateKit Mac app](https://translatekit.app)), leading to more accurate translations while making your localization files easier to maintain.
5858

59+
### Core Strings & Category-Specific Extensions
60+
61+
To keep TranslateKit lightweight while providing comprehensive coverage, the 1,000+ pre-localized strings are organized into two tiers:
62+
63+
1. **Core Strings (250+):**
64+
Included in the base `TranslateKit` package, these strings are commonly used across all kinds of apps, making them universally applicable.
65+
66+
2. **Category-Specific Extensions (~50 per category):**
67+
Each of the **27 App Store categories** has an additional module with strings tailored to that category. For example:
68+
- **Finance apps:** `import TranslateKitFinance`
69+
- **Productivity apps:** `import TranslateKitProductivity`
70+
- **Health & Fitness apps:** `import TranslateKitHealthAndFitness`
71+
72+
These modules also include the core strings, so you only need to import the one matching your app category.
73+
74+
With this modular approach, TranslateKit remains lightweight, adding only ~1MB to your app, making it suitable for any project—big or small.
75+
76+
5977
## Swift Package Usage
6078

6179
For Swift packages, use `#tkm` instead of `#tk` to reference the correct String Catalog file:

0 commit comments

Comments
 (0)