Contents

verblaze/verblaze_swift

Verblaze Swift SDK is a powerful translation management system integration that allows you to easily manage multilingual support in your application. With this SDK, you can dynamically manage and update your translations.

Features

  • 🌍 Multilingual support
  • πŸš€ Easy integration
  • πŸ’Ύ Automatic caching
  • πŸ”„ Automatic version control and updates
  • πŸ“± Optimized for Swift applications
  • ⚑️ High-performance operation
  • πŸ”Œ Simple API integration
  • πŸ”„ Robust error handling

Getting Started

Installation

Add Verblaze Swift SDK to your project with Swift Package Manager:

// Package.swift
dependencies: [
    .package(url: "https://github.com/verblaze/swift-sdk.git", from: "1.0.0")
]

or add it directly using the "Add Package Dependency..." option in Xcode.

Configuration

Initialize the SDK in your application:

import verblaze_swift

// Run when initializing the application
try await Verblaze.configure(apiKey: "YOUR_API_KEY")

Simple Example Configuration

SwiftUI application example:

import SwiftUI
import verblaze_swift

@main
struct ExampleAppApp: App {
    init() {
        Task {
            do {
                try await Verblaze.configure(apiKey: "YOUR_API_KEY")
                if let currentLanguage = Verblaze.getCurrentLanguage(){
                    try Verblaze.setLanguage(currentLanguage)
                }
            } catch {
                // Error handling
            }
        }
    }

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

Usage

Simple Translation

// Using String extension
let translatedText = "home.welcome".vbt

// Or using the translation function directly
let translatedText = Verblaze.translate("home.welcome")

Changing Language

// Set language to English
try Verblaze.setLanguage("en-US")

Current Language Information

// Get current language code
if let currentLang = Verblaze.getCurrentLanguage() {
    print("Current language: \(currentLang)")
}

// Get all supported languages
let languages = Verblaze.getSupportedLanguages()
for language in languages {
    print("\(language.generalName) (\(language.localName))")
}

// Get base language
if let baseLanguage = Verblaze.getBaseLanguage() {
    print("Base language: \(baseLanguage.code)")
}

Advanced Usage

SwiftUI Integration

import SwiftUI
import verblaze_swift

struct ContentView: View {

    var body: some View {
        LocalizedView{
            VStack {
                Text("welcome.title".vbt)
                    .font(.title)

                Text("welcome.description".vbt)
                    .padding()

                Button("welcome.button".vbt) {
                // Operation
                }
                .padding()
            }
        }
    }
}

Error Handling

The SDK provides comprehensive error handling:

do {
    try Verblaze.setLanguage("invalid_language")
} catch let error as VerblazeError {
    print("Translation error: \(error.message)")
} catch {
    print("Unexpected error: \(error.localizedDescription)")
}

Contributing

We welcome your contributions! Please follow these steps:

  1. Fork this repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: Add amazing feature')
  4. Push to your branch (git push origin feature/amazing-feature)
  5. Create a Pull Request

License

This project is licensed under the MIT License. See the LICENSE file for details.

Support

Security

If you discover a security vulnerability, please send an email to info@verblaze.com.

Package Metadata

Repository: verblaze/verblaze_swift

Default branch: main

README: README.md