aboutsummaryrefslogtreecommitdiffstats
path: root/po/xgettext_sh.py
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2004-03-17 06:01:35 +0000
committerBill Nottingham <notting@redhat.com>2004-03-17 06:01:35 +0000
commite0764ced10833e0b8ca135c82da7635a2e88fa8c (patch)
tree9e36606995996b57f82c70a4efee4611b70d88e3 /po/xgettext_sh.py
parent9cdb440efefc35633b2fe37b2e6826f311364929 (diff)
downloadinitscripts-e0764ced10833e0b8ca135c82da7635a2e88fa8c.tar
initscripts-e0764ced10833e0b8ca135c82da7635a2e88fa8c.tar.gz
initscripts-e0764ced10833e0b8ca135c82da7635a2e88fa8c.tar.bz2
initscripts-e0764ced10833e0b8ca135c82da7635a2e88fa8c.tar.xz
initscripts-e0764ced10833e0b8ca135c82da7635a2e88fa8c.zip
catch more input strings (#106285, <mitr@volny.cz>)
Diffstat (limited to 'po/xgettext_sh.py')
-rw-r--r--po/xgettext_sh.py30
1 files changed, 6 insertions, 24 deletions
diff --git a/po/xgettext_sh.py b/po/xgettext_sh.py
index 2abb5954..042d0707 100644
--- a/po/xgettext_sh.py
+++ b/po/xgettext_sh.py
@@ -25,10 +25,12 @@
from sys import argv
from string import find, split, strip
+import re
s = {}
+pattern = re.compile('[ =]\$"')
-def xgettext(arq, tokens_i18n):
+def xgettext(arq):
line = 0
f = open(arq, "r")
while 1:
@@ -38,15 +40,9 @@ def xgettext(arq, tokens_i18n):
if l[0:1] == '#': continue
elif l[0:1] == '\n': continue
else:
- for token in tokens_i18n:
- if token == '=':
- pos = find(l, token + '$"')
- else:
- pos = find(l, token + ' $"')
- if pos != -1:
+ for match in pattern.finditer(l):
+ pos = match.start()
text = split(l[pos:], '"')[1]
- #if find (text, '$') != -1:
- # continue
if s.has_key(text):
s[text].append((arq, line))
else:
@@ -77,22 +73,8 @@ def print_pot():
print 'msgstr ""\n'
def main():
- i18n_tokens = []
- i18n_tokens.append('echo')
- i18n_tokens.append('echo -n')
- i18n_tokens.append('echo -e')
- i18n_tokens.append('echo -en')
- i18n_tokens.append('echo -ne')
- i18n_tokens.append('action')
- i18n_tokens.append('failure')
- i18n_tokens.append('passed')
- i18n_tokens.append('runcmd')
- i18n_tokens.append('success')
- i18n_tokens.append('/sbin/getkey -c $AUTOFSCK_TIMEOUT -m')
- i18n_tokens.append('=')
-
for a in argv:
- xgettext(a, i18n_tokens)
+ xgettext(a)
print_pot()