Skip to content

Commit dfb9a34

Browse files
committed
Merge branch 'master' of git://repo.or.cz/git-gui
* 'master' of git://repo.or.cz/git-gui: git-gui: fix typo in lib/spellcheck.tcl git-gui: Shorten Aspell version strings to just Aspell version number git-gui: Gracefully display non-aspell version errors to users git-gui: Catch and display aspell startup failures to the user git-gui: Only bind the spellcheck popup suggestion hook once git-gui: Remove explicit references to 'aspell' in message strings git-gui: Ensure all spellchecker 'class' variables are initialized git-gui: Update German translation. git-gui: (i18n) Add newly added translation strings to template.
2 parents df4a824 + f49b6c1 commit dfb9a34

File tree

5 files changed

+139
-45
lines changed

5 files changed

+139
-45
lines changed

git-gui/lib/about.tcl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ proc do_about {} {
4141
append v "Tcl version $tcl_patchLevel"
4242
append v ", Tk version $tk_patchLevel"
4343
}
44-
if {[info exists ui_comm_spell]} {
44+
if {[info exists ui_comm_spell]
45+
&& [$ui_comm_spell version] ne {}} {
4546
append v "\n"
4647
append v [$ui_comm_spell version]
4748
}

git-gui/lib/spellcheck.tcl

Lines changed: 60 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
1-
# git-gui spellchecking support through aspell
1+
# git-gui spellchecking support through ispell/aspell
22
# Copyright (C) 2008 Shawn Pearce
33

44
class spellcheck {
55

6-
field s_fd {} ; # pipe to aspell
7-
field s_version ; # aspell version string
8-
field s_lang ; # current language code
6+
field s_fd {} ; # pipe to ispell/aspell
7+
field s_version {} ; # ispell/aspell version string
8+
field s_lang {} ; # current language code
9+
field s_prog aspell; # are we actually old ispell?
10+
field s_failed 0 ; # is $s_prog bogus and not working?
911

1012
field w_text ; # text widget we are spelling
1113
field w_menu ; # context menu for the widget
1214
field s_menuidx 0 ; # last index of insertion into $w_menu
1315

14-
field s_i ; # timer registration for _run callbacks
16+
field s_i {} ; # timer registration for _run callbacks
1517
field s_clear 0 ; # did we erase mispelled tags yet?
1618
field s_seen [list] ; # lines last seen from $w_text in _run
1719
field s_checked [list] ; # lines already checked
18-
field s_pending [list] ; # [$line $data] sent to aspell
20+
field s_pending [list] ; # [$line $data] sent to ispell/aspell
1921
field s_suggest ; # array, list of suggestions, keyed by misspelling
2022

2123
constructor init {pipe_fd ui_text ui_menu} {
2224
set w_text $ui_text
2325
set w_menu $ui_menu
26+
array unset s_suggest
2427

28+
bind_button3 $w_text [cb _popup_suggest %X %Y @%x,%y]
2529
_connect $this $pipe_fd
2630
return $this
2731
}
@@ -33,14 +37,53 @@ method _connect {pipe_fd} {
3337
-translation lf
3438

3539
if {[gets $pipe_fd s_version] <= 0} {
36-
close $pipe_fd
37-
error [mc "Not connected to aspell"]
40+
if {[catch {close $pipe_fd} err]} {
41+
42+
# Eh? Is this actually ispell choking on aspell options?
43+
#
44+
if {$s_prog eq {aspell}
45+
&& [regexp -nocase {^Usage: } $err]
46+
&& ![catch {
47+
set pipe_fd [open [list | $s_prog -v] r]
48+
gets $pipe_fd s_version
49+
close $pipe_fd
50+
}]
51+
&& $s_version ne {}} {
52+
if {{@(#) } eq [string range $s_version 0 4]} {
53+
set s_version [string range $s_version 5 end]
54+
}
55+
set s_failed 1
56+
error_popup [strcat \
57+
[mc "Unsupported spell checker"] \
58+
":\n\n$s_version"]
59+
set s_version {}
60+
return
61+
}
62+
63+
regsub -nocase {^Error: } $err {} err
64+
if {$s_fd eq {}} {
65+
error_popup [strcat [mc "Spell checking is unavailable"] ":\n\n$err"]
66+
} else {
67+
error_popup [strcat \
68+
[mc "Invalid spell checking configuration"] \
69+
":\n\n$err\n\n" \
70+
[mc "Reverting dictionary to %s." $s_lang]]
71+
}
72+
} else {
73+
error_popup [mc "Spell checker silently failed on startup"]
74+
}
75+
return
3876
}
77+
3978
if {{@(#) } ne [string range $s_version 0 4]} {
40-
close $pipe_fd
41-
error [strcat [mc "Unrecognized aspell version"] ": $s_version"]
79+
catch {close $pipe_fd}
80+
error_popup [strcat [mc "Unrecognized spell checker"] ":\n\n$s_version"]
81+
return
4282
}
4383
set s_version [string range $s_version 5 end]
84+
regexp \
85+
{International Ispell Version .* \(but really (Aspell .*?)\)$} \
86+
$s_version _junk s_version
4487

4588
puts $pipe_fd ! ; # enable terse mode
4689
puts $pipe_fd {$$cr master} ; # fetch the language
@@ -65,7 +108,6 @@ method _connect {pipe_fd} {
65108
$w_text tag conf misspelled \
66109
-foreground red \
67110
-underline 1
68-
bind_button3 $w_text [cb _popup_suggest %X %Y @%x,%y]
69111

70112
array unset s_suggest
71113
set s_seen [list]
@@ -75,7 +117,7 @@ method _connect {pipe_fd} {
75117
}
76118

77119
method lang {{n {}}} {
78-
if {$n ne {} && $s_lang ne $n} {
120+
if {$n ne {} && $s_lang ne $n && !$s_failed} {
79121
set spell_cmd [list |]
80122
lappend spell_cmd aspell
81123
lappend spell_cmd --master=$n
@@ -88,7 +130,10 @@ method lang {{n {}}} {
88130
}
89131

90132
method version {} {
91-
return "$s_version, $s_lang"
133+
if {$s_version ne {}} {
134+
return "$s_version, $s_lang"
135+
}
136+
return {}
92137
}
93138

94139
method stop {} {
@@ -333,11 +378,11 @@ method _read {} {
333378
fconfigure $s_fd -block 1
334379
if {[eof $s_fd]} {
335380
if {![catch {close $s_fd} err]} {
336-
set err [mc "unexpected eof from aspell"]
381+
set err [mc "Unexpected EOF from spell checker"]
337382
}
338383
catch {after cancel $s_i}
339384
$w_text tag remove misspelled 1.0 end
340-
error_popup [strcat "Spell Checker Failed" "\n\n" $err]
385+
error_popup [strcat [mc "Spell Checker Failed"] "\n\n" $err]
341386
return
342387
}
343388
fconfigure $s_fd -block 0

git-gui/po/de.po

Lines changed: 47 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: git-gui\n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2008-02-02 10:14+0100\n"
11-
"PO-Revision-Date: 2008-02-02 10:18+0100\n"
10+
"POT-Creation-Date: 2008-02-16 21:24+0100\n"
11+
"PO-Revision-Date: 2008-02-16 21:52+0100\n"
1212
"Last-Translator: Christian Stimming <stimming@tuhh.de>\n"
1313
"Language-Team: German\n"
1414
"MIME-Version: 1.0\n"
@@ -653,7 +653,7 @@ msgstr "Lokale Zweige"
653653

654654
#: lib/branch_delete.tcl:52
655655
msgid "Delete Only If Merged Into"
656-
msgstr "Nur löschen, wenn darin zusammengeführt"
656+
msgstr "Nur löschen, wenn zusammengeführt nach"
657657

658658
#: lib/branch_delete.tcl:54
659659
msgid "Always (Do not perform merge test.)"
@@ -1292,19 +1292,19 @@ msgstr "Warning: Tcl/Tk unterstützt die Zeichencodierung »%s« nicht."
12921292

12931293
#: lib/commit.tcl:221
12941294
msgid "Calling pre-commit hook..."
1295-
msgstr ""
1295+
msgstr "Aufrufen der Vor-Eintragen-Kontrolle..."
12961296

12971297
#: lib/commit.tcl:236
12981298
msgid "Commit declined by pre-commit hook."
1299-
msgstr ""
1299+
msgstr "Eintragen abgelehnt durch Vor-Eintragen-Kontrolle (»pre-commit hook«)."
13001300

13011301
#: lib/commit.tcl:259
13021302
msgid "Calling commit-msg hook..."
1303-
msgstr ""
1303+
msgstr "Aufrufen der Versionsbeschreibungs-Kontrolle..."
13041304

13051305
#: lib/commit.tcl:274
13061306
msgid "Commit declined by commit-msg hook."
1307-
msgstr ""
1307+
msgstr "Eintragen abgelehnt durch Versionsbeschreibungs-Kontrolle (»commit-message hook«)."
13081308

13091309
#: lib/commit.tcl:287
13101310
msgid "Committing changes..."
@@ -1389,7 +1389,7 @@ msgstr "Festplattenplatz von komprimierten Objekten"
13891389

13901390
#: lib/database.tcl:48
13911391
msgid "Packed objects waiting for pruning"
1392-
msgstr "Komprimierte Objekte, die zum Entfernen vorgesehen sind"
1392+
msgstr "Komprimierte Objekte, die zum Aufräumen vorgesehen sind"
13931393

13941394
#: lib/database.tcl:49
13951395
msgid "Garbage files"
@@ -1622,10 +1622,10 @@ msgstr "%s von %s"
16221622

16231623
#: lib/merge.tcl:119
16241624
#, tcl-format
1625-
msgid "Merging %s and %s"
1626-
msgstr "Zusammenführen von %s und %s"
1625+
msgid "Merging %s and %s..."
1626+
msgstr "Zusammenführen von %s und %s..."
16271627

1628-
#: lib/merge.tcl:131
1628+
#: lib/merge.tcl:130
16291629
msgid "Merge completed successfully."
16301630
msgstr "Zusammenführen erfolgreich abgeschlossen."
16311631

@@ -1636,7 +1636,7 @@ msgstr "Zusammenführen fehlgeschlagen. Konfliktauflösung ist notwendig."
16361636
#: lib/merge.tcl:158
16371637
#, tcl-format
16381638
msgid "Merge Into %s"
1639-
msgstr "Zusammenführen in %s"
1639+
msgstr "Zusammenführen in »%s«"
16401640

16411641
#: lib/merge.tcl:177
16421642
msgid "Revision To Merge"
@@ -1741,7 +1741,7 @@ msgstr "Auf Dateiänderungsdatum verlassen"
17411741

17421742
#: lib/option.tcl:111
17431743
msgid "Prune Tracking Branches During Fetch"
1744-
msgstr "Übernahmezweige entfernen während Anforderung"
1744+
msgstr "Übernahmezweige aufräumen während Anforderung"
17451745

17461746
#: lib/option.tcl:112
17471747
msgid "Match Tracking Branches"
@@ -1755,7 +1755,11 @@ msgstr "Anzahl der Kontextzeilen beim Vergleich"
17551755
msgid "New Branch Name Template"
17561756
msgstr "Namensvorschlag für neue Zweige"
17571757

1758-
#: lib/option.tcl:176
1758+
#: lib/option.tcl:191
1759+
msgid "Spelling Dictionary:"
1760+
msgstr "Wörterbuch Rechtschreibprüfung:"
1761+
1762+
#: lib/option.tcl:215
17591763
msgid "Change Font"
17601764
msgstr "Schriftart ändern"
17611765

@@ -1778,31 +1782,31 @@ msgstr "Optionen konnten nicht gespeichert werden:"
17781782

17791783
#: lib/remote_branch_delete.tcl:29 lib/remote_branch_delete.tcl:34
17801784
msgid "Delete Remote Branch"
1781-
msgstr "Zweig aus anderem Projektarchiv löschen"
1785+
msgstr "Zweig in anderem Projektarchiv löschen"
17821786

17831787
#: lib/remote_branch_delete.tcl:47
17841788
msgid "From Repository"
1785-
msgstr "Von Projektarchiv"
1789+
msgstr "In Projektarchiv"
17861790

17871791
#: lib/remote_branch_delete.tcl:50 lib/transport.tcl:123
17881792
msgid "Remote:"
17891793
msgstr "Anderes Archiv:"
17901794

17911795
#: lib/remote_branch_delete.tcl:66 lib/transport.tcl:138
17921796
msgid "Arbitrary URL:"
1793-
msgstr "Kommunikation mit URL:"
1797+
msgstr "Archiv-URL:"
17941798

17951799
#: lib/remote_branch_delete.tcl:84
17961800
msgid "Branches"
17971801
msgstr "Zweige"
17981802

17991803
#: lib/remote_branch_delete.tcl:109
18001804
msgid "Delete Only If"
1801-
msgstr "Löschen, falls"
1805+
msgstr "Nur löschen, wenn"
18021806

18031807
#: lib/remote_branch_delete.tcl:111
18041808
msgid "Merged Into:"
1805-
msgstr "Zusammenführen mit:"
1809+
msgstr "Zusammengeführt mit:"
18061810

18071811
#: lib/remote_branch_delete.tcl:119
18081812
msgid "Always (Do not perform merge checks)"
@@ -1864,7 +1868,7 @@ msgstr "»%s« laden..."
18641868

18651869
#: lib/remote.tcl:165
18661870
msgid "Prune from"
1867-
msgstr "Entfernen von"
1871+
msgstr "Aufräumen von"
18681872

18691873
#: lib/remote.tcl:170
18701874
msgid "Fetch from"
@@ -1882,6 +1886,26 @@ msgstr "Fehler beim Schreiben der Verknüpfung:"
18821886
msgid "Cannot write icon:"
18831887
msgstr "Fehler beim Erstellen des Icons:"
18841888

1889+
#: lib/spellcheck.tcl:37
1890+
msgid "Not connected to aspell"
1891+
msgstr "Keine Verbindung zu »aspell«"
1892+
1893+
#: lib/spellcheck.tcl:41
1894+
msgid "Unrecognized aspell version"
1895+
msgstr "Unbekannte Version von »aspell«"
1896+
1897+
#: lib/spellcheck.tcl:135
1898+
msgid "No Suggestions"
1899+
msgstr "Keine Vorschläge"
1900+
1901+
#: lib/spellcheck.tcl:336
1902+
msgid "Unexpected EOF from aspell"
1903+
msgstr "Unerwartetes EOF von »aspell«"
1904+
1905+
#: lib/spellcheck.tcl:340
1906+
msgid "Spell Checker Failed"
1907+
msgstr "Rechtschreibprüfung fehlgeschlagen"
1908+
18851909
#: lib/status_bar.tcl:83
18861910
#, tcl-format
18871911
msgid "%s ... %*i of %*i %s (%3i%%)"
@@ -1900,12 +1924,12 @@ msgstr "Neue Änderungen von »%s« holen"
19001924
#: lib/transport.tcl:18
19011925
#, tcl-format
19021926
msgid "remote prune %s"
1903-
msgstr "Entfernen von »%s« aus anderem Archiv"
1927+
msgstr "Aufräumen von »%s«"
19041928

19051929
#: lib/transport.tcl:19
19061930
#, tcl-format
19071931
msgid "Pruning tracking branches deleted from %s"
1908-
msgstr "Übernahmezweige entfernen, die in »%s« gelöscht wurden"
1932+
msgstr "Übernahmezweige aufräumen und entfernen, die in »%s« gelöscht wurden"
19091933

19101934
#: lib/transport.tcl:25 lib/transport.tcl:71
19111935
#, tcl-format
@@ -1928,7 +1952,7 @@ msgstr "Zweige versenden"
19281952

19291953
#: lib/transport.tcl:103
19301954
msgid "Source Branches"
1931-
msgstr "Herkunftszweige"
1955+
msgstr "Lokale Zweige"
19321956

19331957
#: lib/transport.tcl:120
19341958
msgid "Destination Repository"

0 commit comments

Comments
 (0)