diff options
author | N.N. <matju@users.sourceforge.net> | 2009-05-17 04:53:51 +0000 |
---|---|---|
committer | N.N. <matju@users.sourceforge.net> | 2009-05-17 04:53:51 +0000 |
commit | 8c05657c586e5ee75651210963cf3c10a01afc16 (patch) | |
tree | dd8cb714994267783e554cc6477920f7e7cc7394 /desiredata | |
parent | 30b311de4c3f9f46512708f94ae7402f1907ab83 (diff) |
adding language "auto" in the GUI
svn path=/trunk/; revision=11421
Diffstat (limited to 'desiredata')
-rw-r--r-- | desiredata/src/desire.tk | 37 | ||||
-rw-r--r-- | desiredata/src/locale/index.tcl | 26 |
2 files changed, 34 insertions, 29 deletions
diff --git a/desiredata/src/desire.tk b/desiredata/src/desire.tk index d8545b33..3dd02c53 100644 --- a/desiredata/src/desire.tk +++ b/desiredata/src/desire.tk @@ -750,35 +750,15 @@ for {set i 0} {$i < $argc} {incr i} { #set cmdline(server) \"$cmdline(server)\" set encoding "" -#lappend langoptions {esperanto} -set langfile locale/[switch -regexp -- $language { - ^(en|english|C)$ {list english} - ^(fr|francais)$ {list francais} - ^(de|deutsch)$ {list deutsch} - ^(ca|catala)$ {list catala} - ^(es|espanol)$ {list espanol} - ^(pt|portugues)$ {list portugues} - ^(it|italiano)$ {list italiano} - ^(nb|norsk|bokmal)$ {list bokmal} - ^(ch|chinese)$ {set encoding utf-8; list chinese} - ^(eu|euskara)$ {list euskara} - ^(eo|esperanto)$ {set encoding utf-8; list esperanto} - ^(pl|polski)$ {set encoding utf-8; list polski} - ^(dk|dansk)$ {list dansk} - ^(ja|japanese|nihongo)$ {list nihongo} - ^(br|brasiliano|brasileiro)$ {list brasileiro} - ^(tr|turkce)$ {set encoding utf-8; list turkce} - ^(nl|nederlands)$ {list nederlands} - ^(ru|russkij)$ {set encoding utf-8; list russkij} - default {error "huh??? unknown language (locale)"} -}].tcl - +if {$language == "C"} {set language en} proc localedir {x} {file join [file dirname [file dirname $::argh0]] lib/pd/bin/$x} +if {[regexp {desire\.tk$} $argh0]} {source locale/index.tcl} {source [localedir locale/index.tcl]} +set langentry [figure_out_language $language] +set encoding [lindex $langentry 0] +set langfile locale/[lindex $langentry 1].tcl if {[regexp {desire\.tk$} $argh0]} { - source locale/index.tcl if {$encoding != ""} {source -encoding $encoding $langfile} else {source $langfile} } else { - source [localedir locale/index.tcl] if {$encoding != ""} {source -encoding $encoding [localedir $langfile]} else {source [localedir $langfile]} } @@ -8300,7 +8280,7 @@ def ClientPrefsDialog get_val {} { global ddrc_options look key accels set check_key {} foreach {type class name} $ddrc_options { - switch $type { + switch -regexp -- $type { color { set str [string tolower $class$name] set look($class:$name) $@$str @@ -8324,7 +8304,7 @@ def ClientPrefsDialog get_val {} { } toggle { set look($class:$name) $@$name} integer {set look($class:$name) $@$name} - choice {set look($class:$name) $@$name} + choice|language {set look($class:$name) $@$name} #font {set look(View:font) $@str} } } @@ -8372,7 +8352,8 @@ def ClientPrefsDialog init {} { } language { set @$name $look(View:$name) - $self add $which_section [list $name choice -choices $::langoptions] + say autolanguage "[say auto] ([say [lindex [figure_out_language [guess_lang]] 1]])" + $self add $which_section [list $name choice -choices [concat autolanguage $::langoptions]] } color { set str [string tolower $class$name] diff --git a/desiredata/src/locale/index.tcl b/desiredata/src/locale/index.tcl index 9b1fcfcb..a06e6513 100644 --- a/desiredata/src/locale/index.tcl +++ b/desiredata/src/locale/index.tcl @@ -4,7 +4,7 @@ say deutsch "Deutsch" say catala "Català" say espanol "Español" say portugues "Português" -say brasileiro "Português Do Brasil" +say brasileiro "Português do Brasil" say italiano "Italiano" say euskara "Euskara" say bokmal "Norsk Bokmål" @@ -25,3 +25,27 @@ set ::langoptions { italiano euskara bokmal dansk nederlands turkce polski russkij chinese nihongo } + +proc figure_out_language {language} { + switch -regexp -- $language { + ^(en|english)$ {list iso8859-1 english} + ^(fr|francais)$ {list iso8859-1 francais} + ^(de|deutsch)$ {list iso8859-1 deutsch} + ^(ca|catala)$ {list iso8859-1 catala} + ^(es|espanol)$ {list iso8859-1 espanol} + ^(pt|portugues)$ {list iso8859-1 portugues} + ^(it|italiano)$ {list iso8859-1 italiano} + ^(nb|bokmal)$ {list iso8859-1 bokmal} + ^(ch|chinese)$ {list utf-8 chinese} + ^(eu|euskara)$ {list iso8859-1 euskara} + ^(eo|esperanto)$ {list utf-8 esperanto} + ^(pl|polski)$ {list utf-8 polski} + ^(dk|dansk)$ {list iso8859-1 dansk} + ^(ja|nihongo)$ {list iso8859-1 nihongo} + ^(br|brasileiro)$ {list iso8859-1 brasileiro} + ^(tr|turkce)$ {list utf-8 turkce} + ^(nl|nederlands)$ {list iso8859-1 nederlands} + ^(ru|russkij)$ {list utf-8 russkij} + default {error "unknown language: $language"} + } +} |