Add availability to get keyPath from generated strings Key enumeration

This commit is contained in:
Thibaut Schmitt 2023-06-07 09:52:36 +02:00
parent d6c4702390
commit beb28e652d
2 changed files with 55 additions and 44 deletions

View File

@ -6,13 +6,24 @@ fileprivate let kStringsFileName = "sampleStrings"
extension String { extension String {
enum Key: String { enum KeyGenAllScript: String {
case param_lang = "param_lang" case param_lang = "param_lang"
case generic_back = "generic_back" case generic_back = "generic_back"
case generic_loading_data = "generic_loading_data" case generic_loading_data = "generic_loading_data"
case generic_welcome_firstname_format = "generic_welcome_firstname_format" case generic_welcome_firstname_format = "generic_welcome_firstname_format"
case test_equal_symbol = "test_equal_symbol" case test_equal_symbol = "test_equal_symbol"
case placeholders_test_one = "placeholders_test_one" case placeholders_test_one = "placeholders_test_one"
var keyPath: KeyPath<String, String> {
switch self {
case .param_lang: return \String.param_lang
case .generic_back: return \String.generic_back
case .generic_loading_data: return \String.generic_loading_data
case .generic_welcome_firstname_format: return \String.generic_welcome_firstname_format
case .test_equal_symbol: return \String.test_equal_symbol
case .placeholders_test_one: return \String.placeholders_test_one
}
}
} }
// MARK: - Webservice // MARK: - Webservice

View File

@ -2,33 +2,33 @@
FORCE_FLAG="$1" FORCE_FLAG="$1"
# Font ## Font
swift run -c release ResgenSwift fonts $FORCE_FLAG "./Fonts/sampleFontsAll.txt" \ #swift run -c release ResgenSwift fonts $FORCE_FLAG "./Fonts/sampleFontsAll.txt" \
--extension-output-path "./Fonts/Generated" \ # --extension-output-path "./Fonts/Generated" \
--extension-name "UIFontYolo" \ # --extension-name "UIFontYolo" \
--extension-name-swift-ui "FontYolo" \ # --extension-name-swift-ui "FontYolo" \
--extension-suffix "GenAllScript" \ # --extension-suffix "GenAllScript" \
--info-plist-paths "./Fonts/Generated/test.plist ./Fonts/Generated/test2.plist" # --info-plist-paths "./Fonts/Generated/test.plist ./Fonts/Generated/test2.plist"
#
echo "\n-------------------------\n" #echo "\n-------------------------\n"
#
# Color ## Color
swift run -c release ResgenSwift colors $FORCE_FLAG "./Colors/sampleColors1.txt" \ #swift run -c release ResgenSwift colors $FORCE_FLAG "./Colors/sampleColors1.txt" \
--style all \ # --style all \
--xcassets-path "./Colors/colors.xcassets" \ # --xcassets-path "./Colors/colors.xcassets" \
--extension-output-path "./Colors/Generated/" \ # --extension-output-path "./Colors/Generated/" \
--extension-name "UIColorYolo" \ # --extension-name "UIColorYolo" \
--extension-name-swift-ui "ColorYolo" \ # --extension-name-swift-ui "ColorYolo" \
--extension-suffix "GenAllScript" # --extension-suffix "GenAllScript"
#
echo "\n-------------------------\n" #echo "\n-------------------------\n"
#
# Twine ## Twine
swift run -c release ResgenSwift strings twine $FORCE_FLAG "./Twine/sampleStrings.txt" \ #swift run -c release ResgenSwift strings twine $FORCE_FLAG "./Twine/sampleStrings.txt" \
--output-path "./Twine/Generated" \ # --output-path "./Twine/Generated" \
--langs "fr en en-us" \ # --langs "fr en en-us" \
--default-lang "en" \ # --default-lang "en" \
--extension-output-path "./Twine/Generated" # --extension-output-path "./Twine/Generated"
echo "\n-------------------------\n" echo "\n-------------------------\n"
@ -43,19 +43,19 @@ swift run -c release ResgenSwift strings stringium $FORCE_FLAG "./Strings/sample
echo "\n-------------------------\n" echo "\n-------------------------\n"
# Tags ## Tags
swift run -c release ResgenSwift strings tags $FORCE_FLAG "./Tags/sampleTags.txt" \ #swift run -c release ResgenSwift strings tags $FORCE_FLAG "./Tags/sampleTags.txt" \
--lang "ium" \ # --lang "ium" \
--extension-output-path "./Tags/Generated" \ # --extension-output-path "./Tags/Generated" \
--extension-name "Tags" \ # --extension-name "Tags" \
--extension-suffix "GenAllScript" # --extension-suffix "GenAllScript"
#
echo "\n-------------------------\n" #echo "\n-------------------------\n"
#
# Images ## Images
swift run -c release ResgenSwift images $FORCE_FLAG "./Images/sampleImages.txt" \ #swift run -c release ResgenSwift images $FORCE_FLAG "./Images/sampleImages.txt" \
--xcassets-path "./Images/imagium.xcassets" \ # --xcassets-path "./Images/imagium.xcassets" \
--extension-output-path "./Images/Generated" \ # --extension-output-path "./Images/Generated" \
--extension-name "UIImage" \ # --extension-name "UIImage" \
--extension-name-swift-ui "ImageYolo" \ # --extension-name-swift-ui "ImageYolo" \
--extension-suffix "GenAllScript" # --extension-suffix "GenAllScript"