Better handle posix names for locales
This commit is contained in:
parent
21dd98964e
commit
a5718682d1
@ -41,20 +41,29 @@ AWKCMD="/## PLACEHOLDER/ { \
|
||||
|
||||
# Rename the sources with 3 components name into the POSIX version of the name using @modifier
|
||||
cd $old
|
||||
pwd
|
||||
for i in *_*_*.*.src; do
|
||||
if [ "$i" = "*_*_*.*.src" ]; then
|
||||
break
|
||||
fi
|
||||
oldname=${i%.*}
|
||||
nname=`echo $oldname | awk '{ split($0, a, "_"); print a[1]"_"a[3]"@"a[2];} '`
|
||||
mv -i ${oldname}.src ${nname}.src
|
||||
mv -f ${oldname}.src ${nname}.src
|
||||
sed -i '' -e "s/${oldname}/${nname}/g" Makefile
|
||||
COLLATIONS_SPECIAL=$(echo ${COLLATIONS_SPECIAL} | sed -e "s/${oldname}/${nname}/g")
|
||||
done
|
||||
sed -i '' -Ee "s/([a-zA-Z]{2})_([a-zA-Z]+)_([a-zA-Z]{2}).([a-zA-Z0-9-]+)/\1_\3.\4@\2/g" ${old}/Makefile
|
||||
|
||||
# For variable without @modifier ambiguity do not keep the @modifier
|
||||
for i in *@*.src; do
|
||||
if [ "$i" = "*@*.src" ]; then
|
||||
break
|
||||
fi
|
||||
oldname=${i%.*}
|
||||
shortname=${oldname%@*}
|
||||
if [ $(ls ${shortname}@* | wc -l) -eq 1 -a ! -f ${shortname}.src ] ; then
|
||||
mv -i $i ${shortname}.src
|
||||
sed -i '' -e "s/${oldname}/${shortname}/g" ${old}/Makefile
|
||||
if [ $(ls ${shortname}@* | wc -l) -eq 1 ] ; then
|
||||
mv -f $i ${shortname}.src
|
||||
sed -i '' -e "s/${oldname}/${shortname}/g" Makefile
|
||||
COLLATIONS_SPECIAL=$(echo ${COLLATIONS_SPECIAL} | sed -e "s/${oldname}/${shortname}/g")
|
||||
fi
|
||||
done
|
||||
|
||||
@ -63,16 +72,19 @@ for i in *@Latn.src; do
|
||||
if [ "$i" = "*@Latn.src" ]; then
|
||||
break
|
||||
fi
|
||||
mv ${i} ${i%@*}@latin.src
|
||||
mv -f ${i} ${i%@*}@latin.src
|
||||
sed -i '' -e "s/${i%.*}/${i%@*}@latin/g" Makefile
|
||||
COLLATIONS_SPECIAL=$(echo ${COLLATIONS_SPECIAL} | sed -e "s/${i%.*}/${i%@*}@latin/g")
|
||||
done
|
||||
sed -i '' -e "s/@Latn/@latin/g" ${old}/Makefile
|
||||
|
||||
for i in *@Cyrl.src; do
|
||||
if [ "$i" = "*@Cyrl.src" ]; then
|
||||
break
|
||||
fi
|
||||
mv ${i} ${i%@*}@cyrillic.src
|
||||
mv -f ${i} ${i%@*}@cyrillic.src
|
||||
sed -i '' -e "s/${i%.*}/${i%@*}@cyrillic/g" Makefile
|
||||
COLLATIONS_SPECIAL=$(echo ${COLLATIONS_SPECIAL} | sed -e "s/${i%.*}/${i%@*}@cyrillic/g")
|
||||
done
|
||||
sed -i '' -e "s/@Cyrl/@cyrillic/g" ${old}/Makefile
|
||||
|
||||
# On locales with multiple modifiers rename the "default" version without the @modifier
|
||||
default_locales="sr_RS@cyrillic"
|
||||
@ -83,8 +95,8 @@ for i in ${default_locales}; do
|
||||
if [ "$l" = "${localename}.*@${mod}.src" ]; then
|
||||
break
|
||||
fi
|
||||
mv ${l} ${l%@*}.src
|
||||
sed -i '' -e "s/${l%.*}/${l%@*}/g" ${old}/Makefile
|
||||
mv -f ${l} ${l%@*}.src
|
||||
sed -i '' -e "s/${l%.*}/${l%@*}/g" Makefile
|
||||
done
|
||||
done
|
||||
cd -
|
||||
@ -146,13 +158,12 @@ then
|
||||
done
|
||||
echo "" >> ${TEMP4}
|
||||
for enc in ${COLLATIONS_SPECIAL}; do
|
||||
nname=`echo $enc | sed -e 's/_Hans//g'`
|
||||
sed -i '' "/^.*${nname}$/d" ${TEMP4}
|
||||
echo "LOCALES+= ${nname}" >> ${TEMP4}
|
||||
sed -i '' "/^.*${enc}$/d" ${TEMP4}
|
||||
echo "LOCALES+= ${enc}" >> ${TEMP4}
|
||||
done
|
||||
|
||||
keep=$(cat ${TEMP} | awk '{ print $2 }')
|
||||
for original in ${keep}
|
||||
for original in ${keep} ${COLLATIONS_SPECIAL}
|
||||
do
|
||||
cp ${old}/${original}.src ${new}/
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user