Created
April 24, 2020 17:22
-
-
Save croccio/2c01496d054d93dc977a60de44308129 to your computer and use it in GitHub Desktop.
Enable multiple Localizable.strings on xCode 11.x.x with new build system
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 | |
# MergeLocalizable.sh | |
# EAD | |
# | |
# Created by Antonio Scardigno on 24/04/2020. | |
# Copyright © 2020 UPU. All rights reserved. | |
############################################################ | |
##ONLY FOR TEST############################################# if u would run it from terminal uncomment these line | |
#SRCROOT = "put path folder that contain project file. " ## ex: /Users/username/xCodeProject/myApp | |
#PROJECT_NAME = "put name of project" ## ex: MyApp | |
############################################################ | |
### ENVIRONMENT VARIABLE DURING BUILD | |
### SRCROOT root of the project | |
### PROJECT_NAME name of the project | |
### move into resources folder of the porject | |
cd "${SRCROOT}/${PROJECT_NAME}/Resource" | |
### foreach folder ending with .lproj | |
for file in *; do | |
if [[ -d "$file" ]] && [[ "$file" == *".lproj" ]]; then | |
### move in | |
cd "$file" | |
### clear Localizable .strings | |
echo "" > Localizable.strings | |
### for each .localizable.strings files | |
for file in *.localizable.strings; do | |
### read it | |
while read line; do | |
### and append in Localizable.strings | |
echo "$line" >> Localizable.strings | |
done < $file | |
done | |
### go to previous folder and then start it agin with next .lproj folder | |
cd ".." | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To use it:
So the structure should be this: