summaryrefslogtreecommitdiff
path: root/po
diff options
context:
space:
mode:
authorTapio Lehtonen <tale@debian.org>2009-09-09 09:42:35 +0000
committerTapio Lehtonen <tale@debian.org>2009-09-09 09:42:35 +0000
commita5affb8cd17b60a9489d9f48db2a3ebf3eb549f4 (patch)
tree7b95939d37b24740ec92e5e20c64bbb81ff4b40e /po
parent4eebb383ebe36f02ab921b1b99a37e4de9f7feaa (diff)
downloadinstallation-guide-a5affb8cd17b60a9489d9f48db2a3ebf3eb549f4.zip
Seems to work OK, finds error words and does not crash.
Now to add reading word lists.
Diffstat (limited to 'po')
-rwxr-xr-xpo/fi/make-fi-all.py45
1 files changed, 22 insertions, 23 deletions
diff --git a/po/fi/make-fi-all.py b/po/fi/make-fi-all.py
index 8d604067c..0a288ec34 100755
--- a/po/fi/make-fi-all.py
+++ b/po/fi/make-fi-all.py
@@ -32,7 +32,7 @@ Print out unknown words found in filename. Options
-p and --wordlist can be given several times."""
lhelpstr = """What language is the text to proofread? For example fi_FI."""
parser = OptionParser(usage=usage)
- parser.set_defaults(verbose=True)
+ parser.set_defaults(verbose=False)
parser.add_option("-p", "--wordlist",
action="append", type="string", dest="wordlists",
help="File with OK words one per line.",
@@ -67,12 +67,11 @@ Print out unknown words found in filename. Options
if __name__ == "__main__":
from enchant.checker import SpellChecker
- import fi
o, a = handleCommandLine()
if o.verbose:
- print o
- print a
+ print "options ", o
+ print "arguments ", a
try:
textF = open(a[0], "r")
@@ -80,29 +79,29 @@ if __name__ == "__main__":
print "Erroria", value
sys.exit(4)
- text = textF.readlines()
- textF.close()
- if o.verbose:
- print "Text as read:"
- print text
- print "Text to check is:"
- for l in text:
- print l.strip()
+ #text = textF.readlines()
if o.verbose:
+ import sys
print "Language is", o.language
- chkr = SpellChecker(o.language)
+ print "STDOUT encoding ", sys.stdout.encoding
+ print "sys default encoding", sys.getdefaultencoding()
+ checker = SpellChecker(o.language)
if o.verbose:
- if chkr.wants_unicode:
+ if checker.wants_unicode:
print "Checker wants Unicode text to check."
else:
print "Checker wants normal strings text to check."
+ for text in textF.readlines():
+ utext = unicode(text, "utf-8")
+ if o.verbose:
+ print "Text as read:"
+ print text
+ print "Text to check is:"
+ for u in utext:
+ print u.encode("utf-8"),
+ print
+ checker.set_text(utext)
+ for err in checker:
+ print err.word.encode("utf-8")
- utext = u""
- for t in text:
- utext += unicode(t, "utf-8")
- chkr.set_text(utext)
- for err in chkr:
- print err.word
-
-
-
+ textF.close()