ProjectLocale SDK

A static XCFramework for iOS that delivers over-the-air translations to your app. Download the SDK, add it to your Xcode project, and start syncing translations in minutes.

Swift Package Manager

Add the SDK to your project via SPM — the recommended way to install. No source code, just a prebuilt binary package.

View SPM Package on GitHub

Sample Project

A complete Xcode project that demonstrates SDK integration — configure, sync, and display translations with SwiftUI.

View on GitHub

Installation

Option A — Swift Package Manager (recommended)

  1. In Xcode, go to File → Add Package Dependencies...
  2. Enter the repository URL: https://github.com/biometricid/p-locale.eu
  3. Select Up to Next Major Version (1.1.0) and click Add Package

Or add to your Package.swift: .package(url: "https://github.com/biometricid/p-locale.eu", from: "1.1.0")

Option B — Manual

  1. Download ProjectLocale.xcframework.zip and unzip it
  2. Drag ProjectLocale.xcframework into your Xcode project
  3. In your target's General tab, make sure the framework appears under Frameworks, Libraries, and Embedded Content with Do Not Embed (it is a static library)

Quick Start

Configure the SDK once on app launch, then use L10nText in SwiftUI or L10n.string() anywhere.

import ProjectLocale

// 1. Configure on launch
try L10n.configure(
    apiKey: "pl_your_api_key",
    serverURL: URL(string: "https://p-locale.eu")!,
    environment: "prod",
    appVersion: Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
)

// 2. Sync translations
let info = try await L10n.projectInfo()
let synced = try await L10n.syncAll()

// 3. Use in SwiftUI
L10nText("common/welcome_title", default: "Welcome")

// 4. Use anywhere
let title = L10n.string("common/welcome_title", default: "Welcome")

// 5. Switch language
L10n.setLanguage("uk")

Getting Your API Key

  1. Create an account at p-locale.eu
  2. Create a new project in the dashboard
  3. Go to project settings — your API key (pl_...) is displayed there
  4. Use the API key in L10n.configure() on app launch

How Sync Works

  1. First launch — the SDK downloads the full translation set for all languages
  2. Subsequent launches — only changed keys are downloaded (delta sync). If nothing changed, the server responds with 304 — zero traffic
  3. Offline — cached translations from the previous session are used. If no cache exists, the SDK falls back to default values provided in code