Files
OSGKeyboard/OSGKeyboardExt/Utilities/ExtL10n.swift
T
Rocky e2ccc10cfd fix: embed Keyboard.strings in extension bundle for keyboard l10n
XcodeGen merged Localizable.strings into the main app only, so the keyboard
extension had no .lproj files and NSLocalizedString returned raw keys. Use a
dedicated Keyboard.strings table and explicit buildPhase: resources entries.
2026-06-19 18:44:32 +08:00

34 lines
936 B
Swift

// ExtL10n.swift
// OSGKeyboard · Keyboard Extension
//
// Loads strings from Keyboard.strings in the extension bundle. We use a
// dedicated strings table (not Localizable.strings) because XcodeGen merges
// duplicate Localizable.strings variant groups into the main app target only.
import Foundation
import SwiftUI
enum ExtL10n {
private static let table = "Keyboard"
private static let bundle = Bundle(for: KeyboardViewController.self)
static func string(_ key: String) -> String {
let value = NSLocalizedString(
key,
tableName: table,
bundle: bundle,
value: key,
comment: ""
)
return value
}
static func text(_ key: String) -> Text {
Text(string(key))
}
static func format(_ key: String, _ args: CVarArg...) -> String {
String(format: string(key), locale: Locale.current, arguments: args)
}
}