Skip to content

Commit 17f71e3

Browse files
committed
Revert "added localization support"
This reverts commit 81f5da2.
1 parent 81f5da2 commit 17f71e3

File tree

4 files changed

+8
-37
lines changed

4 files changed

+8
-37
lines changed

Sources/BuilderIO/BuilderIOManager.swift

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,24 @@ public final class BuilderIOManager {
1515

1616
private let apiKey: String
1717
public let customNavigationScheme: String
18-
public let locale: String?
1918

2019
private static var registered = false
2120

22-
public static func configure(
23-
apiKey: String, customNavigationScheme: String = "builderio", locale: String? = nil
24-
) {
21+
public static func configure(apiKey: String, customNavigationScheme: String = "builderio") {
2522
guard _shared == nil else {
2623
print(
2724
"Warning: BuilderIOManager has already been configured. Ignoring subsequent configuration.")
2825
return
2926
}
3027
Font.registerFonts()
31-
_shared = BuilderIOManager(
32-
apiKey: apiKey, customNavigationScheme: customNavigationScheme, locale: locale)
28+
_shared = BuilderIOManager(apiKey: apiKey, customNavigationScheme: customNavigationScheme)
3329
}
3430

3531
// MARK: - Private Initialization
3632

37-
private init(apiKey: String, customNavigationScheme: String, locale: String?) {
33+
private init(apiKey: String, customNavigationScheme: String) {
3834
self.apiKey = apiKey
3935
self.customNavigationScheme = customNavigationScheme
40-
self.locale = locale
4136

4237
if !Self.registered {
4338
BuilderComponentRegistry.shared.initialize()
@@ -65,7 +60,7 @@ public final class BuilderIOManager {
6560
model: model,
6661
apiKey: apiKey,
6762
url: resolvedUrl,
68-
locale: locale ?? "",
63+
locale: "",
6964
preview: ""
7065
) {
7166
return .success(content)

Sources/BuilderIO/ComponentRegistry/BuilderComponentProtocol.swift

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,6 @@ extension BuilderViewProtocol {
1818
func codeBindings() -> [String: String]? {
1919
return nil
2020
}
21-
22-
func localize(localizedValue: AnyCodable) -> String? {
23-
24-
if let localeDictionary = localizedValue.dictionaryValue {
25-
if let currentLocale = BuilderIOManager.shared.locale {
26-
if let localizedString = localeDictionary[currentLocale]?.stringValue {
27-
return localizedString
28-
}
29-
}
30-
31-
return localeDictionary["Default"]?.stringValue
32-
33-
} else {
34-
return localizedValue.stringValue
35-
}
36-
}
3721
}
3822

3923
struct BuilderEmptyView: BuilderViewProtocol {

Sources/BuilderIO/Components/BuilderImage.swift

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ struct BuilderImage: BuilderViewProtocol {
66
var block: BuilderBlockModel
77
var children: [BuilderBlockModel]?
88

9-
var imageURL: URL? = nil
9+
var imageURL: URL?
1010
var aspectRatio: CGFloat? = nil
1111
var lockAspectRatio: Bool = false
1212
var contentMode: ContentMode = .fit
@@ -16,12 +16,8 @@ struct BuilderImage: BuilderViewProtocol {
1616

1717
init(block: BuilderBlockModel) {
1818
self.block = block
19-
20-
if let imageLink = block.component?.options?.dictionaryValue?["image"] {
21-
self.imageURL = URL(
22-
string: localize(localizedValue: imageLink) ?? "")
23-
}
24-
19+
self.imageURL = URL(
20+
string: block.component?.options?.dictionaryValue?["image"]?.stringValue ?? "")
2521
if let ratio = block.component?.options?.dictionaryValue?["aspectRatio"]?.doubleValue {
2622
self.aspectRatio = CGFloat(1 / ratio)
2723
}

Sources/BuilderIO/Components/BuilderText.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ struct BuilderText: BuilderViewProtocol {
1111

1212
init(block: BuilderBlockModel) {
1313
self.block = block
14-
15-
if let textValue = block.component?.options?.dictionaryValue?["text"] {
16-
self.text = localize(localizedValue: textValue) ?? ""
17-
}
18-
14+
self.text = block.component?.options?.dictionaryValue?["text"]?.stringValue ?? ""
1915
self.responsiveStyles = getFinalStyle(responsiveStyles: block.responsiveStyles)
2016

2117
if let textBinding = block.codeBindings(for: "text") {

0 commit comments

Comments
 (0)