transliterate

Transliteration engine
git clone git://lumidify.org/transliterate.git
Log | Files | Refs | README | LICENSE

commit 1adf70462c0ec838b8611ce505c139862a768e6d
parent b27447c8434d4678ccec8141416b85bb45a7c9a6
Author: lumidify <nobody@lumidify.org>
Date:   Mon, 30 Mar 2020 11:03:49 +0200

Sort table list before displaying in GUI

Diffstat:
Mtransliterate.pl | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/transliterate.pl b/transliterate.pl @@ -167,7 +167,7 @@ sub prompt_unknown_word { $hbox->pack_start($label, FALSE, FALSE, 0); $label->show; my $path_list = Gtk2::ComboBox->new_text; - foreach my $path (keys %$table_paths) { + foreach my $path (sort keys %$table_paths) { $path_list->append_text($path); } $hbox->pack_start($path_list, FALSE, FALSE, 0); @@ -648,9 +648,9 @@ sub check_args { # $config_list - the list returned by parse_config sub interpret_config { my ($config_list, $args) = @_; - my %tables; my %config; $config{"table_paths"} = {}; + $config{"tables"} = {}; $config{"ignore"} = ""; $config{"ignore_words"} = {}; $config{"split"} = "\\s"; @@ -692,11 +692,11 @@ sub interpret_config { if (!$table) { return undef; } - $tables{$cmd->[1]->{"value"}} = $table; + $config{tables}->{$cmd->[1]->{"value"}} = $table; $tmp_table_paths{$cmd->[1]->{"value"}} = $cmd->[2]->{"value"}; } elsif ($cmd->[0]->{"value"} eq "expand") { # FIXME: need to handle table paths when a new table name is used for the expansion - if (!expand_table($cmd, \%tables, \%config)) { + if (!expand_table($cmd, $config{tables}, \%config)) { return undef; } } elsif ($cmd->[0]->{"value"} eq "group") { @@ -742,7 +742,7 @@ sub interpret_config { return undef; } my $table = $cmd->[1]->{"value"}; - if (!exists($tables{$table})) { + if (!exists($config{tables}->{$table})) { warn "ERROR: nonexistent table \"$table\" in replace statement.\n"; return undef; } @@ -752,7 +752,7 @@ sub interpret_config { # Note: we don't need to check if $table{"choicesep"} was defined # here since we can't ever get this far without first having # loaded a table anyways - add_to_trie($table, $config{"replacements"}->[-1]->{"words"}, $tables{$table}, $args, \%config); + add_to_trie($table, $config{"replacements"}->[-1]->{"words"}, $config{tables}->{$table}, $args, \%config); } elsif ($cmd->[0]->{"value"} eq "split") { $config{"split"} = $cmd->[1]->{"value"}; } elsif ($cmd->[0]->{"value"} eq "beforeword") {