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.
This commit is contained in:
@@ -1,17 +1,26 @@
|
||||
// ExtL10n.swift
|
||||
// OSGKeyboard · Keyboard Extension
|
||||
//
|
||||
// Loads strings from the keyboard extension bundle (not SwiftUI's default
|
||||
// bundle, which may not see our Localizable.strings).
|
||||
// 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 {
|
||||
NSLocalizedString(key, bundle: bundle, comment: "")
|
||||
let value = NSLocalizedString(
|
||||
key,
|
||||
tableName: table,
|
||||
bundle: bundle,
|
||||
value: key,
|
||||
comment: ""
|
||||
)
|
||||
return value
|
||||
}
|
||||
|
||||
static func text(_ key: String) -> Text {
|
||||
|
||||
Reference in New Issue
Block a user