languages.sh 627 B

123456789101112131415161718
  1. echo "["
  2. for lang in $(ls [a-z][a-z].xml |sed s/.xml//)
  3. do
  4. echo '{ type: "language", iso: "'${lang}'",'
  5. # countries that use this language
  6. echo 'countries: ['
  7. ls ${lang}_[A-Z][A-Z].xml | sed -e 's/^.*_/{_reference: "/' -e 's/.xml/"},/'
  8. echo '],'
  9. # name of this language (in this language)
  10. grep '<language type="'${lang}'"[ >]' ${lang}.xml |head -1 |sed -e 's/.*<language type=".."[^>]*>/name: "/' -e 's/<\/language>/",/'
  11. # names of other langauges (in this language)
  12. grep '<language type="..">' ${lang}.xml |sed -e 's/.*<language type=//' -e 's/<\/language>/",/' -e 's/>/: "/' -e 's/-->//'
  13. echo '},'
  14. done
  15. echo "]"