File indexing completed on 2024-04-21 14:47:10

0001 #! /bin/sh
0002 #
0003 # (LW 18/04/2002) Stripped trailing slashes from comments, to keep make happy
0004 # (JH 16/08/2002) Patch submitted by Stefan Asserhall to deal with diacritic characters properly
0005 # (JH 16/08/2002) modified to sort strings alphabetically and filter through uniq.
0006 # (HE 31/08/2002) treat cities, regions, countries separately
0007 
0008 rm -f kstars_i18n.cpp
0009 rm -f cities.tmp
0010 rm -f regions.tmp
0011 rm -f countries.tmp
0012 echo "#if 0" >> kstars_i18n.cpp
0013 
0014 # extract constellations
0015 sed -e "s/\([0-9].*[a-z]\)//" < data/cnames.dat | sed 's/^[A-B] //' | \
0016    sed 's/\([A-Z].*\)/xi18nc("Constellation name (optional)", "\1");/' | sed 's/\ "/"/g' >> "kstars_i18n.cpp"
0017 
0018 # extract sky cultures
0019 grep ^C data/cnames.dat | gawk '{ print "xi18nc( \"Sky Culture\", \"" $2 "\" );" }' >> "kstars_i18n.cpp"
0020 
0021 # City data (name, province, country)
0022 python3 data/scripts/extract_geo_data.py >> "kstars_i18n.cpp"
0023 
0024 # extract image/info menu items
0025 gawk '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"
0026 sort --unique image_url.tmp >> kstars_i18n.cpp
0027 gawk '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"
0028 sort --unique info_url.tmp >> kstars_i18n.cpp
0029 
0030 # star names : some might be different in other languages, or they might have to be adapted to non-Latin alphabets
0031 # TODO: Move this thing to starnames.dat
0032 cat data/stars.dat | gawk 'BEGIN { FS=", "; } ($1!~/#/ && NF==3) { printf( "xi18nc(\"star name\", \"%s\");\n", $3); }' >> kstars_i18n.cpp;
0033 
0034 # extract satellite group names
0035 cat data/satellites.dat | gawk 'BEGIN {FS=";"} ($1!~/#/) { printf( "xi18nc(\"Satellite group name\", \"%s\");\n", $1); }' >> kstars_i18n.cpp;
0036 
0037 # Extract asteroids
0038 cat data/asteroids.dat | gawk '{if (NR!=1) {{FPAT = "([^,]*)|(\"[^\"]+\")"}; {gsub("\"",""); name = substr($1,8); printf("xi18nc(\"Asteroid name (optional)\",\"%s\")\n",name)}}}' >> kstars_i18n.cpp;
0039 
0040 # Extract comets
0041 cat data/comets.dat | gawk '{if (NR!=1) {{FPAT = "([^,]*)|(\"[^\"]+\")"}; {gsub("\"",""); sub(/^[ \t]+/, ""); printf("xi18nc(\"Comet name (optional)\",\"%s\")\n",$1)}}}' >> kstars_i18n.cpp;
0042 
0043 # extract strings from file containing advanced URLs:
0044 cat data/advinterface.dat | gawk '( match( $0, "KSLABEL" ) ) { \
0045 name=substr($0,10); \
0046 printf( "xi18nc(\"Advanced URLs: description or category\", \"%s\")\n", name ); }' >> kstars_i18n.cpp
0047 
0048 # finish file
0049 echo "#endif" >> kstars_i18n.cpp
0050 # cleanup temporary files
0051 rm -f image_url.tmp
0052 rm -f info_url.tmp
0053 rm -f tips.cpp
0054 
0055 $EXTRACTRC `find . -name '*.ui' -o -name '*.rc' -o -name '*.kcfg' | sort` >> rc.cpp || exit 11
0056 (cd data && $PREPARETIPS > ../tips.cpp)
0057 $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
0058 rm -f tips.cpp
0059 rm -f kstars_i18n.cpp
0060 rm -f rc.cpp
0061