https://github.com/flinedev/translatekit
SF Symbols for Texts: 2000+ built-in translations in 40 languages + semantic localization key macro for Swift devs
https://github.com/flinedev/translatekit
ai apple i18n internationalization ios l10n localization macos mobile-development sdk sfsymbols swift swift-package translation tvos visionos watchos xcode
Last synced: 3 months ago
JSON representation
SF Symbols for Texts: 2000+ built-in translations in 40 languages + semantic localization key macro for Swift devs
- Host: GitHub
- URL: https://github.com/flinedev/translatekit
- Owner: FlineDev
- License: mit
- Created: 2024-11-27T13:53:44.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-05-07T04:57:30.000Z (5 months ago)
- Last Synced: 2025-06-05T23:08:38.503Z (4 months ago)
- Topics: ai, apple, i18n, internationalization, ios, l10n, localization, macos, mobile-development, sdk, sfsymbols, swift, swift-package, translation, tvos, visionos, watchos, xcode
- Language: Swift
- Homepage: https://translatekit.app
- Size: 5.85 MB
- Stars: 142
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

[](https://swiftpackageindex.com/FlineDev/TranslateKit)
# TranslateKit SDK
What SF Symbols is for Icons, TranslateKit is for Text!
Eliminate localization overhead in your Swift apps with 2000+ pre-localized strings and semantic key generation. Make app localization simple, accurate, and delightful.
## Key Features
### 1. Pre-localized Common Strings
Access 2,000+ ready-to-use strings in ~40 Apple platform languages across four categories. These match the [officially supported iOS system languages](https://www.apple.com/ios/feature-availability/#system-language-system-language) and utilize Apple's own translations where available, ensuring consistency with the system UI.Since they are pre-localized, they won't add entries to your String Catalog – just use them directly:
```swift
// Actions: Interactive UI elements
Button(TK.Action.save) { saveData() } // "Save" → "Sichern" (German)// Labels: Non-interactive text
Label(TK.Label.notifications, systemImage: "bell") // "Notifications" → "Benachrichtigungen"// Placeholders: Temporary text
TextField(TK.Label.firstName, text: $firstName, // "First Name" → "Vorname"
prompt: TK.Placeholder.firstNameExample) // "e.g. Jane" → "z.B. Erika"// Messages: Full sentences
Text(TK.Message.anErrorOccurred) // "An Error Occurred" → "Ein Fehler ist aufgetreten"
```Discovering the right translations is effortless with autocompletion – type `TK.` to explore categories and fuzzy-match strings, with English previews and usage hints in the documentation popover:

### 2. Smart Key Generation
The `#tk` macro eliminates the tedious work of manual key management by automatically generating semantic keys based on code context:```swift
struct SettingsView: View {
let documentName: String
var body: some View {
// Generates key: SettingsView.Body.saveChanges
Button(#tk("Save Changes")) { handleSave() }
// Add context with 'c' parameter to help translators
Text(#tk("Save changes to \(documentName)?",
c: "e.g. 'Save changes to MyNumbers.csv'"))
}
}
```String Catalogs made it challenging to maintain best practices from the Strings-file era, where using semantic keys helped group related translations. The macro brings back this advantage while keeping String Catalogs' benefits - you get semantic keys without writing verbose `String(localized:defaultValue:comment:)` calls:

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.
### Core Strings & Category-Specific Extensions
To keep TranslateKit lightweight while providing comprehensive coverage, the 2,000+ pre-localized strings are organized into two tiers:
1. **Core Strings (250+):**
Included in the base `TranslateKit` package, these strings are commonly used across all kinds of apps, making them universally applicable.2. **Category-Specific Extensions (~100 per category):**
Each of the **26 App Store categories** has an additional module with strings tailored to that category. For example:
- **Finance apps:** `import TranslateKitFinance`
- **Productivity apps:** `import TranslateKitProductivity`
- **Health & Fitness apps:** `import TranslateKitHealthAndFitness`
These modules also include the core strings, so you only need to import the one matching your app category.With this modular approach, TranslateKit remains lightweight, adding only ~1MB to your app, making it suitable for any project – big or small.
## Swift Package Usage
For Swift packages, use `#tkm` instead of `#tk` to reference the correct String Catalog file:
1. Add `defaultLocalization` to your manifest:
```swift
let package = Package(
name: "FormKit",
defaultLocalization: "en",
// ...
)
```2. Add `Localizable.xcstrings` to your module (right-click folder > "New File from Template…" > String Catalog)
3. Use the `#tkm` macro with optional comment:
```swift
struct FormValidator {
static func validatePassword(_ password: String) -> String? {
guard password.count >= 8 else {
return #tkm("Password must be at least 8 characters")
}
return nil
}
}
```Common reasons to localize Swift packages are that they may contain UI elements (e.g. modularized apps) or that they might provide error descriptions, which should be localized in most cases.
## Solving Macro Trust Issues in Xcode Cloud
If you're using Xcode Cloud or experiencing issues with macro trust, check out our guide [Solving Swift Macro Trust Issues in Xcode Cloud Builds](https://www.fline.dev/solving-swift-macro-trust-issues-in-xcode-cloud-builds/). This article explains how to properly configure your build settings when CI systems don't automatically trust macro packages.
## Using TranslateKit without Macros
If you don't want to use the `tk` macro but still profit from the community-driven common strings in your app, you can also opt for one of the `Lite` targets instead of the regular ones. For example, instead of adding and importing the `TranslateKit` target to your app, you can instead add & import `TranslateKitLite`. For category-specific variants, instead of something like `TranslateKitGames`, use `TranslateKitGamesLite`.
The `Lite` variants of the targets ensure that Xcode (and CI workflows) won't ask you to "Trust & Enable" macros in TranslateKit. But they also lack the added context you get when using `#tk` macro. We include these macros by default because we recommend everyone using them, but the `Lite` targets give you a way to opt-out when needed.
## Contributing
Contributions – especially additions and corrections – are welcome!
Please feel free to submit a Pull Request. You don't need to localize added entries to all languages yourself, just provide the one(s) you speak, we'll take care of the other languages using [TranslateKit](https://translatekit.app). But please keep the entries sorted alphabetically when adding new ones!
For bigger changes, please open an issue first to discuss what you would like to change.
## Showcase
I created this library for my own Indie apps (download & rate them to show your appreciation):
App Icon
App Name & Description
Supported Platforms
![]()
TranslateKit: App Localization
AI-powered app localization with unmatched accuracy. Fast & easy: AI & proofreading, 125+ languages, market insights. Budget-friendly, free to try.
Mac
![]()
FreemiumKit: In-App Purchases for Indies
Simple In-App Purchases and Subscriptions: Automation, Paywalls, A/B Testing, Live Notifications, PPP, and more.
iPhone, iPad, Mac, Vision
![]()
Pleydia Organizer: Movie & Series Renamer
Simple, fast, and smart media management for your Movie, TV Show and Anime collection.
Mac
![]()
FreelanceKit: Project Time Tracking
Simple & affordable time tracking with a native experience for all devices. iCloud sync & CSV export included.
iPhone, iPad, Mac, Vision
![]()
CrossCraft: Custom Crosswords
Create themed & personalized crosswords. Solve them yourself or share them to challenge others.
iPhone, iPad, Mac, Vision
![]()
FocusBeats: Pomodoro + Music
Deep Focus with proven Pomodoro method & select Apple Music playlists & themes. Automatically pauses music during breaks.
iPhone, iPad, Mac, Vision
![]()
Posters: Discover Movies at Home
Auto-updating & interactive posters for your home with trailers, showtimes, and links to streaming services.
Vision