Last active
January 11, 2022 08:03
-
-
Save trilliwon/dec9c07e0f18da2c0f143c96f3d0b2ea to your computer and use it in GitHub Desktop.
makeI18N
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "generating I18N.swift" | |
touch tempI18N.swift | |
echo "struct I18N {" >> tempI18N.swift | |
inputfile=${SRCROOT}/Pomodoro/Resources/en.lproj/Localizable.strings | |
while IFS= read -r line | |
do | |
echo $line | |
pattern='^[a-zA-Z]+(.*)[\\s]*=[\\s]*(.*)$' | |
comment='\/\/.+' | |
if [[ $line =~ $pattern ]] | |
then | |
echo "Yes👌" | |
variableName=$(echo ${line%%=*}) | |
echo $variableName | |
if [ "$variableName" != "" ]; then | |
echo " static let $variableName = \"$variableName\".localized" >> tempI18N.swift | |
fi | |
else | |
if [[ $line =~ $comment ]] | |
then | |
echo "Comment 📝" | |
echo "\n $line" >> tempI18N.swift | |
else | |
echo "No👎" | |
fi | |
fi | |
done <"$inputfile" | |
echo "}" >> tempI18N.swift | |
cat tempI18N.swift > ${SRCROOT}/Pomodoro/Resources/I18N.swift | |
rm tempI18N.swift | |
echo "-------------" | |
cat $inputfile | |
cat ${SRCROOT}/Manhwakyung-ios/Resources/I18N.swift | |
echo "-------------" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://medium.com/@trilliwon/ios%EC%97%90%EC%84%9C-localization%ED%95%98%EB%8A%94-gorgeous-%ED%95%9C-%EB%B0%A9%EB%B2%95-f82ac29d2cfe