Magellan Linux

Diff of /tags/installer-simple-0_4_91_20160616_1/generate-po.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2356 by niro, Mon Jan 6 12:24:58 2014 UTC revision 2357 by niro, Mon Jan 6 12:26:01 2014 UTC
# Line 12  usage() Line 12  usage()
12   echo "Known methods:"   echo "Known methods:"
13   echo "   --create-pot - creates pot file from script"   echo "   --create-pot - creates pot file from script"
14   echo "   --append-pot - appends current pot file with script"   echo "   --append-pot - appends current pot file with script"
15     echo "   --unique-pot - remove duplicates from pot file"
16   echo "   --generate   - generates pot and po files"   echo "   --generate   - generates pot and po files"
17   echo "   --compile    - compiles mo files"   echo "   --compile    - compiles mo files"
18   echo   echo
# Line 39  append_pot() Line 40  append_pot()
40   bash --dump-po-strings "${script}" >> "${pot}"   bash --dump-po-strings "${script}" >> "${pot}"
41  }  }
42    
43    unique_pot()
44    {
45     local pot
46    
47     install -d locale
48     pot="locale/${domain}.pot"
49     if [ ! -f "${pot}" ]
50     then
51     echo "Error: ${pot} missing - run --create-pot or --append-pot"
52     exit 1
53     fi
54    
55     # remove duplicate messages
56     msguniq --unique --no-wrap --sort-by-file --output-file="${pot}.fixed" "${pot}"
57     if [[ $? = 0 ]]
58     then
59     rm "${pot}"
60     mv "${pot}.fixed" "${pot}"
61     else
62     echo "Error: msguniq failed"
63     exit 1
64     fi
65    }
66    
67  generate_po()  generate_po()
68  {  {
69   local lang   local lang
# Line 103  fi Line 128  fi
128  case ${method} in  case ${method} in
129   --create-pot) create_pot ;;   --create-pot) create_pot ;;
130   --append-pot) append_pot ;;   --append-pot) append_pot ;;
131     --unique-pot) unique_pot ;;
132   --generate) generate_po ;;   --generate) generate_po ;;
133   --compile) generate_mo ;;   --compile) generate_mo ;;
134   *) usage ;;   *) usage ;;

Legend:
Removed from v.2356  
changed lines
  Added in v.2357