Android的多语言文件转IOS多语言文件格式

多语言(https://www.jianshu.com/p/5f6a5d074fde

命令行
cd /Users/xxx/Desktop/语言包
chmod u+x and_ios.sh
./and_ios.sh xxx.xml > SWLanguage.strings

./and2ios.sh en/strings.xml > en/sw.strings
./and2ios.sh en-DK/strings.xml > en-DK/sw.strings
./and2ios.sh de/strings.xml > de/sw.strings
./and2ios.sh es-ES/strings.xml > es-ES/sw.strings
./and2ios.sh fr/strings.xml > fr/sw.strings
./and2ios.sh id/strings.xml > id/sw.strings
./and2ios.sh it/strings.xml > it/sw.strings
./and2ios.sh ja/strings.xml > ja/sw.strings
./and2ios.sh ko/strings.xml > ko/sw.strings
./and2ios.sh nl/strings.xml > nl/sw.strings
./and2ios.sh pt-PT/strings.xml > pt-PT/sw.strings
./and2ios.sh sv-SE/strings.xml > sv-SE/sw.strings
./and2ios.sh tr/strings.xml > tr/sw.strings
./and2ios.sh zh-CN/strings.xml > zh-CN/sw.strings
./and2ios.sh zh-TW/strings.xml > zh-TW/sw.strings

cp -R en NewString
cp -R en-DK NewString
cp -R de NewString
cp -R es-ES NewString
cp -R fr NewString
cp -R id NewString
cp -R it NewString
cp -R ja NewString
cp -R ko NewString
cp -R nl NewString
cp -R pt-PT NewString
cp -R sv-SE NewString
cp -R tr NewString
cp -R zh-CN NewString
cp -R zh-TW NewString

!/bin/bash

FILENAME=$1

awk '
BEGIN{
FS = "^ <string | >|</string>.|^ * *";
}
{
if (/<string.
name=".
".>.</string>.*/){ match(2, /name *= *"[^ ]+"/)
name = substr(2, RSTART + 5, RLENGTH - 5) print name " \= \""3 "";"
}
else if(//)
print "// "2; else if(/^ */)
print ""
}' $FILENAME

推荐阅读更多精彩内容