Skip to content

Commit

Permalink
#1 #2 updated output format
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo committed Jan 1, 2024
1 parent 5feb5f3 commit 0c153c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
4 changes: 2 additions & 2 deletions StringCatalogEnum/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ NAME=xcstrings-enum-generate
FILENAME_USAGE=USAGE.md

# TODO: get from ENV
EXPORT_PROJECT_ROOT=~/prj/business/quible/quible-ios
EXPORT_PROJECT_ROOT=~/prj/quible/quible-ios
# TODO: remove other hard-coded paths

all: debug
Expand Down Expand Up @@ -34,4 +34,4 @@ doc:
./$(NAME) --help >> $(FILENAME_USAGE)
echo '```' >> $(FILENAME_USAGE)

publish: release doc
publish: release doc
15 changes: 6 additions & 9 deletions StringCatalogEnum/Sources/StringCatalogEnum/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,16 @@ struct StringCatalogEnum: ParsableCommand {
let secondCases = helper.createEnumKeys(with: strings, keyNameMatches: false, keywordEnum: keywordRawValues)

output += """
\(firstCases)
// MARK: - The following cases should be manually replaced in your codebase.
// MARK: - The following cases should be manually replaced in your codebase.
\(secondCases)
/// Usage: `SwiftUI.Text(\(enumTypealias).yourStringCatalogKey.key)`
var key: LocalizedStringKey { LocalizedStringKey(rawValue) }
/// Usage: `SwiftUI.Text(\(enumTypealias).yourStringCatalogKey.key)`
var key: LocalizedStringKey { LocalizedStringKey(rawValue) }
var string: String { NSLocalizedString(self.rawValue, comment: "Generated localization from String Catalog key: \\(key)") }
var string: String { NSLocalizedString(self.rawValue, comment: "Generated localization from String Catalog key: \\(key)") }
// var text: String.LocalizationValue { String.LocalizationValue(rawValue) }
// var text: String.LocalizationValue { String.LocalizationValue(rawValue) }
}
// swiftlint:enable all
"""
Expand All @@ -91,4 +88,4 @@ struct StringCatalogEnum: ParsableCommand {
}
}

StringCatalogEnum.main()
StringCatalogEnum.main()

0 comments on commit 0c153c0

Please sign in to comment.