diff --git a/locales/make_locales.sh b/locales/make_locales.sh index 708c2ea476..b61240ded3 100755 --- a/locales/make_locales.sh +++ b/locales/make_locales.sh @@ -8,18 +8,15 @@ for f in "${@}"; do ${code}" done -#have a map to iterate over -map="$(echo "${code}" | grep -F unsigned | sed -e "s/.* \([a-zA-Z_]\+\)\[\] =.*/{\"\1\",{\1,\1+/g" -e "s/.* \([a-zA-Z_]\+\) =.*/\1}},/g" | tr -d '\n' | sed -e "s/}},{/}},\n {/g")" -for key in $(echo "${map}" | grep -F '_json"' | sed -e "s/.*{\"//g" -e "s/\",.*//g"); do - k="$(echo "${key}" | sed -e "s/_json//g" -e "s/_/-/g")" - map="$(echo "${map}" | sed -e "s/\"${key}\"/\"${k}\"/g")" -done - #output the code echo "#include " echo "${code}" echo "const std::unordered_map locales_json = {"; -echo " ${map}" +for f in "${@}"; do + key="${f%.*}" + var="$(echo ${f} | sed -e "s/[-.]/_/g")" + echo " {\"${key}\", {${var}, ${var} + ${var}_len}}," +done echo "};"; #install locales locally for testing