1#!/bin/sh 2 3# Copyright (C) 1987-2015 by Jeffery P. Hansen 4# Copyright (C) 2015-2018 by Andrey V. Skvortsov 5# 6# This program is free software; you can redistribute it and/or modify 7# it under the terms of the GNU General Public License as published by 8# the Free Software Foundation; either version 2 of the License, or 9# (at your option) any later version. 10# 11# This program is distributed in the hope that it will be useful, 12# but WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14# GNU General Public License for more details. 15# 16# You should have received a copy of the GNU General Public License along 17# with this program; if not, write to the Free Software Foundation, Inc., 18# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19# 20 21# Author: Loginov Alexey (alexl@mageia.org) 22 23pot_file="manuals.pot" 24pot_tmp_file="tmp.pot" 25 26rm -f $pot_file 27rm -f $pot_tmp_file 28 29for file in `find ./en -name *.v` 30do 31 # find translatable strings 32 cat $file | grep '\(//: comment\|//: /line:\|//: /end\)' >> $pot_file 33 cat $file | grep '\(//: property title\|/tx:\)' >> $pot_tmp_file 34 echo "" >> $pot_tmp_file 35done 36 37# mark comment as XXXXX 38sed -i 's|^.*//: comment.*$|XXXXX|g' $pot_file 39# delete parts of /line: 40sed -i 's|^.*//: /line:||g' $pot_file 41# "EOL -> YYYYY" 42sed -i 's|"$|YYYYY"|g' $pot_file 43# mark lines with /end as ZZZZZ 44sed -i "s|^.*//: /end|ZZZZZ|g" $pot_file 45# delete strings, what contents .v" 46sed -i '/.v"/d' $pot_tmp_file 47# //: property title = " -> XXXXX" 48sed -i "s|//: property title = \"|XXXXX\"|g" $pot_tmp_file 49# /tx:" -> XXXXX" 50sed -i "s|.*/tx:\"|XXXXX\"|g" $pot_tmp_file 51# delete empty strings 52sed -i '/XXXXX""/d' $pot_tmp_file 53# "EOL -> "\nZZZZZ\n 54sed -i "s|\"$|\"\nZZZZZ\n|g" $pot_tmp_file 55# add property titles 56cat $pot_tmp_file >> $pot_file 57 58# delete EOL everywhere 59sed -i ':a;N;$!ba;s/\n//g' $pot_file 60# add EOL before XXXXX 61sed -i "s|XXXXX|\nXXXXX|g" $pot_file 62# delete the first string 63sed -i -e "1d" $pot_file 64 65# delete untranslatable strings 66sed -i '/biggatelogo.gif/d' $pot_file 67sed -i '/⇓/d' $pot_file 68sed -i '/⇐/d' $pot_file 69sed -i '/⇒/d' $pot_file 70sed -i '/bigcircuit.gif/d' $pot_file 71sed -i '/bigdetails.gif/d' $pot_file 72sed -i '/bigiface.gif/d' $pot_file 73sed -i '/bigmodule.gif/d' $pot_file 74sed -i '/bigtextedit.gif/d' $pot_file 75sed -i '/connect_example.gif/d' $pot_file 76sed -i '/example_bindings.gif/d' $pot_file 77sed -i '/example_name.gif/d' $pot_file 78sed -i '/iface.gif/d' $pot_file 79sed -i '/makejoint_example.gif/d' $pot_file 80sed -i '/modlistfig.gif/d' $pot_file 81sed -i '/netprops.gif/d' $pot_file 82sed -i '/simulate.gif/d' $pot_file 83sed -i '/<---/d' $pot_file 84sed -i '/--->/d' $pot_file 85sed -i '/|YYYYY""vYYYYY/d' $pot_file 86sed -i '/<tutorial-navigation/d' $pot_file 87 88# delete the same strings 89sort -u $pot_file |uniq -u > $pot_tmp_file 90 91# XXXXX -> msgid ""EOL 92sed -i 's|XXXXX|msgid ""\n|g' $pot_tmp_file 93# YYYYY"ZZZZZ -> "ZZZZZ 94sed -i 's|YYYYY"ZZZZZ|"ZZZZZ|g' $pot_tmp_file 95# ZZZZZ -> EOLmsgstr ""EOL 96sed -i 's|ZZZZZ|\nmsgstr ""\n|g' $pot_tmp_file 97# YYYYY" -> \n"EOL 98sed -i 's|YYYYY"|\\n"\n|g' $pot_tmp_file 99# ^"" -> "\n" 100sed -i 's|^""|"\\n"|g' $pot_tmp_file 101 102rm -f $pot_file 103 104# add header 105echo '# This file is part of TkGate project' >> $pot_file 106echo '# Copyright (C) 1987-2015 by Jeffery P. Hansen' >> $pot_file 107echo '# Copyright (C) 2015-2018 by Andrey V. Skvortsov' >> $pot_file 108echo '# This file is distributed under the same license as the TkGate package.' >> $pot_file 109echo '# ' >> $pot_file 110echo '# ##############################################################################' >> $pot_file 111echo '# Generated by manuals2pot script' >> $pot_file 112echo '# ##############################################################################' >> $pot_file 113echo '# ' >> $pot_file 114echo '#, fuzzy' >> $pot_file 115echo 'msgid ""' >> $pot_file 116echo 'msgstr ""' >> $pot_file 117echo '"Project-Id-Version: tkgate\n"' >> $pot_file 118echo '"Report-Msgid-Bugs-To: \n"' >> $pot_file 119echo '"POT-Creation-Date: 2018-12-05 17:04+0300\n"' >> $pot_file 120echo '"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"' >> $pot_file 121echo '"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"' >> $pot_file 122echo '"Language-Team: LANGUAGE <LL@li.org>\n"' >> $pot_file 123echo '"Language: \n"' >> $pot_file 124echo '"MIME-Version: 1.0\n"' >> $pot_file 125echo '"Content-Type: text/plain; charset=UTF-8\n"' >> $pot_file 126echo '"Content-Transfer-Encoding: 8bit\n"' >> $pot_file 127echo '' >> $pot_file 128 129# add from tmp pot file to main pot file 130cat $pot_tmp_file >> $pot_file 131# delete temporary pot file 132rm -f $pot_tmp_file 133