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 |
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 |
|
mv "${pot}" "${pot}.dump" |
60 |
|
cp "${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 |
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 ;; |