PageRenderTime 53ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/kstars/Messages.sh

https://gitlab.com/g10h4ck/kstars
Shell | 63 lines | 34 code | 12 blank | 17 comment | 2 complexity | 1a0e1cfc0d82c4e80441246edafaa9dc MD5 | raw file
Possible License(s): GPL-2.0, CC-BY-SA-3.0
  1. #! /bin/sh
  2. #
  3. # (LW 18/04/2002) Stripped trailing slashes from comments, to keep make happy
  4. # (JH 16/08/2002) Patch submitted by Stefan Asserhall to deal with diacritic characters properly
  5. # (JH 16/08/2002) modified to sort strings alphabetically and filter through uniq.
  6. # (HE 31/08/2002) treat cities, regions, countries separately
  7. rm -f kstars_i18n.cpp
  8. rm -f cities.tmp
  9. rm -f regions.tmp
  10. rm -f countries.tmp
  11. echo "#if 0" >> kstars_i18n.cpp
  12. # extract constellations
  13. sed -e "s/\([0-9].*[a-z]\)//" < data/cnames.dat | sed 's/^[A-B] //' | \
  14. sed 's/\([A-Z].*\)/xi18nc("Constellation name (optional)", "\1");/' | sed 's/\ "/"/g' >> "kstars_i18n.cpp"
  15. # extract sky cultures
  16. grep ^C data/cnames.dat | awk '{ print "xi18nc( \"Sky Culture\", \"" $2 "\" );" }' >> "kstars_i18n.cpp"
  17. # City data (name, province, country)
  18. python data/scripts/extract_geo_data.py >> "kstars_i18n.cpp"
  19. # extract image/info menu items
  20. awk 'BEGIN {FS=":"}; (NF==4 && $3~"http") {gsub(/\"/, "\\\""); print "xi18nc(\"Image/info menu item (should be translated)\",\"" $2 "\");"; }' < data/image_url.dat | sed 's/xi18nc(.*,"");//' >> "image_url.tmp"
  21. sort --unique image_url.tmp >> kstars_i18n.cpp
  22. awk 'BEGIN {FS=":"}; (NF==4 && $3~"http") {gsub(/\"/, "\\\""); print "xi18nc(\"Image/info menu item (should be translated)\",\"" $2 "\");"; }' < data/info_url.dat | sed 's/xi18nc(.*,"");//' >> "info_url.tmp"
  23. sort --unique info_url.tmp >> kstars_i18n.cpp
  24. # star names : some might be different in other languages, or they might have to be adapted to non-Latin alphabets
  25. # TODO: Move this thing to starnames.dat
  26. cat data/stars.dat | gawk 'BEGIN { FS=", "; } ($1!~/\#/ && NF==3) { printf( "xi18nc(\"star name\", \"%s\");\n", $3); }' >> kstars_i18n.cpp;
  27. # extract satellite group names
  28. cat data/satellites.dat | gawk 'BEGIN {FS=";"} ($1!~/\#/) { printf( "xi18nc(\"Satellite group name\", \"%s\");\n", $1); }' >> kstars_i18n.cpp;
  29. # extract deep-sky object names (sorry, I don't know perl-fu ;( ...using AWK )
  30. cat data/ngcic.dat | grep -v '^#' | gawk '{ split(substr( $0, 77 ), name, " "); \
  31. if ( name[1]!="" ) { \
  32. printf( "%s", name[1] ); i=2; \
  33. while( name[i]!="" ) { printf( " %s", name[i] ); i++; } \
  34. printf( "\n" ); } }' | sort --unique | gawk '{ \
  35. printf( "xi18nc(\"object name (optional)\", \"%s\");\n", $0 ); }' >> kstars_i18n.cpp
  36. # extract strings from file containing advanced URLs:
  37. cat data/advinterface.dat | gawk '( match( $0, "KSLABEL" ) ) { \
  38. name=substr($0,10); \
  39. printf( "xi18nc(\"Advanced URLs: description or category\", \"%s\")\n", name ); }' >> kstars_i18n.cpp
  40. # finish file
  41. echo "#endif" >> kstars_i18n.cpp
  42. # cleanup temporary files
  43. rm -f image_url.tmp
  44. rm -f info_url.tmp
  45. rm -f tips.cpp
  46. $EXTRACTRC `find . -name '*.ui' -o -name '*.rc' -o -name '*.kcfg' | sort` >> rc.cpp || exit 11
  47. (cd data && $PREPARETIPS > ../tips.cpp)
  48. $XGETTEXT -C --from-code=UTF-8 --keyword=xi18n --keyword=xi18nc:1c,2 `find . -name '*.cpp' -o -name '*.h' -o -name '*.qml' | sort` -o $podir/kstars.pot
  49. rm -f tips.cpp
  50. rm -f kstars_i18n.cpp
  51. rm -f rc.cpp