code-gen-library - localization-swift module with Python bash script execute to localization swift files(struct and extension) by localization strings file
sh code_gen_lib_example.sh
sh localization-swift.sh --info
In the __init__ method of the Base class call child from : FileOperation
you can string file with under folder path -p
-p /string-file-path
you can string file with full path -fp
-fp /Users/***/Desktop/..
sh localization-swift.sh -fp /Users/***/Desktop/App/localization-swift/Localizable.strings
generated files ...
Localization-General+Extensions.swift
Localization-Components+Extensions.swift
Localization-Pages+Extensions.swift
Localization-Shared+Extensions.swift
Localization-PushNotification+Extensions.swift
sh localization-swift.sh -p modules/localization-swift/Localizable.strings
generated files ...
Localization-General+Extensions.swift
Localization-Components+Extensions.swift
Localization-Pages+Extensions.swift
Localization-Shared+Extensions.swift
Localization-PushNotification+Extensions.swift
sh localization-swift.sh -p modules/localization-swift/Localizable.strings -o localization
generated files ...
localization/Localization-General+Extensions.swift
localization/Localization-Components+Extensions.swift
localization/Localization-Pages+Extensions.swift
localization/Localization-Shared+Extensions.swift
localization/Localization-PushNotification+Extensions.swift
code-gen-lib localization module parameters with generating outside the run directory folder -ofp for full path
sh localization-swift.sh -p modules/localization-swift/Localizable.strings -ofp /Users/***/Desktop/localization
generated files ...
/Users/***/Desktop/localization/Localization-General+Extensions.swift
/Users/***/Desktop/localization/Localization-Components+Extensions.swift
/Users/***/Desktop/localization/Localization-Pages+Extensions.swift
/Users/***/Desktop/localization/Localization-Shared+Extensions.swift
/Users/***/Desktop/localization/Localization-PushNotification+Extensions.swift
The missing package manager for macOS. Homebrew won’t install files outside its prefix, and you can place a Homebrew installation wherever you like.
After installed Homebrew, execute following commands
$ brew install localization-swift --HEAD
For localization-swift installation, run the following command:
$ brew search oneframemobile/localization-swift/localization-swift
$ brew install localization-swift
#1.2 current version
$ sudo chmod 755 /usr/local/Cellar/localization-swift/1.2/libexec/localization-swift.sh
#1.2 current version
$ sh /usr/local/Cellar/localization-swift/1.2/libexec/localization-swift.sh -p Localizable.strings
The recommended way to use Localization-swift is to create a "Run Script" Build Phase (Xcode > Project > Targets > Your build target > Build Phases > New Run Script Phase)
# Type a script or drag a script file from your workspace to insert its path.
set -x
# Get base path to project
BASE_PATH="$PROJECT_DIR/$PROJECT_NAME"
LOCALIZABLE_FILE="Localizable.strings"
LOCALIZABLE_FILE_PATH="$BASE_PATH/$LOCALIZABLE_FILE"
OUTPUT_FILE_PATH="$BASE_PATH/Localization"
echo $LOCALIZABLE_FILE_PATH
LOCALIZABLE_COMMAND="sh /usr/local/Cellar/localization-swift/1.2/libexec/localization-swift.sh -fp "$LOCALIZABLE_FILE_PATH" -ofp "$OUTPUT_FILE_PATH
$LOCALIZABLE_COMMAND