TranslateKit

1.0.0

SF Symbols for Texts: 2000+ built-in translations in 40 languages + semantic localization key macro for Swift devs
FlineDev/TranslateKit

What's New

1.0.0

2025-02-06T22:05:45Z

Initial Release 🎉

Full Changelog: https://github.com/FlineDev/TranslateKit/commits/1.0.0

TranslateKit SDK Logo

TranslateKit SDK

What SF Symbols is for Icons, TranslateKit is for Text!

Eliminate localization overhead in your Swift apps with 1000+ pre-localized strings and semantic key generation. Make app localization simple, accurate, and delightful.

Key Features

1. Pre-localized Common Strings

Access 1,000+ ready-to-use strings in ~40 Apple platform languages across four categories. Since these are pre-localized, they won't add entries to your String Catalog – just use them directly:

// 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:

Showcasing Autocompletion in Xcode

2. Smart Key Generation

The #tk macro eliminates the tedious work of manual key management by automatically generating semantic keys based on code context:

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:

Macro Expansion in Xcode

These semantic keys help group related translations and provide crucial context to translators and translation tools (like the TranslateKit Mac app), leading to more accurate translations while making your localization files easier to maintain.

Swift Package Usage

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

  1. Add defaultLocalization to your manifest:
.target(
  name: "MyModule",
  defaultLocalization: "en"
)
  1. Add Localizable.xcstrings to your module

  2. Use the #tkm macro:

Text(#tkm("Last seen %@", c: "Time when user was last active"))

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. 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 thank me!):

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

Description

  • Swift Tools 6.0.0
View More Packages from this Author

Dependencies

Last updated: Wed Feb 19 2025 10:07:44 GMT-1000 (Hawaii-Aleutian Standard Time)