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:
- Fork this repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: Add amazing feature') - Push to your branch (
git push origin feature/amazing-feature) - Create a Pull Request
License
This project is licensed under the MIT License. See the LICENSE file for details.
Support
- Documentation: Verblaze Documentation
- Report an issue: GitHub Issues
- Email: support@verblaze.com
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