Skip to content

Commit

Permalink
Make generated sources public
Browse files Browse the repository at this point in the history
  • Loading branch information
david-swift committed Mar 6, 2024
1 parent a00d5d4 commit 402b79f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Sources/GenerationLibrary/Generation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ public enum Generation {
}
return [
"""
enum Localized {
public enum Localized {
static var yml: String {
public static var yml: String {
\"""
\(indent(yml, by: indentTwo))
\"""
}
\(generateEnumCases(dictionary: dictionary))
var string: String { string(for: System.getLanguage()) }
public var string: String { string(for: System.getLanguage()) }
\(try generateTranslations(dictionary: dictionary, defaultLanguage: defaultLanguage))
Expand All @@ -65,7 +65,7 @@ public enum Generation {
}
""",
"""
enum Loc {
public enum Loc {
\(generateStaticLocVariables(dictionary: dictionary))
Expand Down Expand Up @@ -111,11 +111,11 @@ public enum Generation {
let key = parse(key: entry.key)
if key.1.isEmpty {
result.append("""
static var \(entry.key): String { Localized.\(entry.key).string }
public static var \(entry.key): String { Localized.\(entry.key).string }
""")
} else {
var line = "static func \(key.0)("
var line = "public static func \(key.0)("
for argument in key.1 {
line += "\(argument): CustomStringConvertible, "
}
Expand Down Expand Up @@ -144,7 +144,7 @@ public enum Generation {
static func generateTranslations(dictionary: [String: [String: String]], defaultLanguage: String) throws -> String {
var result = ""
for language in getLanguages(dictionary: dictionary) {
var variable = indent("var \(language): String {", by: indentOne)
var variable = indent("public var \(language): String {", by: indentOne)
variable += indent("\nswitch self {", by: indentTwo)
for entry in dictionary {
let key = parse(key: entry.key)
Expand Down Expand Up @@ -222,7 +222,7 @@ public enum Generation {
dictionary: [String: [String: String]],
defaultLanguage: String
) -> String {
var result = "func string(for language: String) -> String {\n"
var result = "public func string(for language: String) -> String {\n"
let languages = getLanguages(dictionary: dictionary)
for language in languages where language != defaultLanguage {
result += indent("if language.hasPrefix(\"\(language)\") {", by: indentTwo)
Expand Down

0 comments on commit 402b79f

Please sign in to comment.