diff --git a/README.md b/README.md index 5122f52..060eaeb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## What's that -The *aloupe v0.9.1* is a Tcl/Tk small widget / utility allowing to view the screen through a loupe. +The *aloupe v0.9.4* is a Tcl/Tk small widget / utility allowing to view the screen through a loupe. It allows also @@ -25,7 +25,7 @@ The *aloupe* utility runs with the command: where `option` may be `-size, -zoom, -alpha, -background, -geometry, -ontop`. -The `Img` and `treectrl` packages have to be installed to run it. In Debian Linux the packages are titled `libtk-img` and `tktreectrl`. +The `Img` and `treectrl` packages have to be installed to run it. In Debian Linux the packages are titled `libtk-img` and `tktreectrl`. If *aloupe* is run by a *tclkit* that doesn't provide these packages, define an environment variable `TCLLIBPATH` before running *aloupe* so that `TCLLIBPATH` be a list of pathes to the packages. There are also stand-alone [aloupe executables](https://github.com/aplsimple/aloupe/releases) for Linux / Windows. @@ -58,6 +58,7 @@ The *aloupe* can be run with the options: * `-ontop` - if *yes* (default), sets the displaying window above others * `-save` - if *yes* (default), saves/restores the appearance settings * `-inifile` - a file to save the settings (~/.config/aloupe.conf by default) + * `-locale` - a preferable locale (e.g., ru, ua, cz) Some options can be used at running *aloupe* from a Tcl code: diff --git a/aloupe.tcl b/aloupe.tcl index ef0fb4b..8be571e 100644 --- a/aloupe.tcl +++ b/aloupe.tcl @@ -11,15 +11,23 @@ # _______________________________________________________________________ # package require Tk -#lappend auto_path C:/ActiveTcl/lib/treectrl2.4.1 -#lappend auto_path /usr/lib/treectrl2.4.1 + +# use TCLLIBPATH variable (some tclkits don't see it) +catch { + foreach _apave_ [lreverse $::env(TCLLIBPATH)] { + if {[lsearch -exact $::auto_path $_apave_]<0} { + set ::auto_path [linsert $::auto_path 0 $_apave_] + } + } + unset _apave_ +} + package require treectrl -#lappend auto_path C:/ActiveTcl/lib/Img1.4.6 -#lappend auto_path /usr/lib/tcltk/x86_64-linux-gnu/Img1.4.9 package require Img + ::msgcat::mcload [file join [file dirname [info script]] msgs] -package provide aloupe 0.9.2 +package provide aloupe 0.9.4 # _______________________________________________________________________ # @@ -41,6 +49,7 @@ namespace eval ::aloupe { -parent "" \ -save yes \ -inifile "~/.config/aloupe.conf" \ + -locale "" \ ] } } @@ -557,6 +566,12 @@ proc ::aloupe::run {args} { my::Synopsis } } + if {$my::data(-locale) ne {}} { + catch { + ::msgcat::mcload [file join [file dirname [info script]] msgs] + ::msgcat::mclocale $my::data(-locale) + } + } catch {::apave::obj untouchWidgets "*_a_loupe_loup*"} ;# don't theme the loupe set my::size [set my::data(PREVSIZE) $my::data(-size)] set my::zoom [set my::data(PREVZOOM) $my::data(-zoom)] @@ -573,5 +588,5 @@ if {[info exist ::argv0] && [file normalize $::argv0] eq [file normalize [info s ::aloupe::run {*}$::argv } # _________________________________ EOF _________________________________ # -#-ARGS1: -alpha .2 -background "yellow" -ontop 1 -save 1 -inifile 123 -commandname "Get" +#-ARGS1: -locale ua -alpha .2 -background "yellow" -ontop 1 -save 1 -commandname "Get" #-RUNF1: ~/PG/github/pave/tests/test2_pave.tcl 23 9 12 "small icons" diff --git a/msgs/ua.msg b/msgs/ua.msg new file mode 100644 index 0000000..b716d08 --- /dev/null +++ b/msgs/ua.msg @@ -0,0 +1,11 @@ +namespace eval ::aloupe { + ::msgcat::mcset ua {Loupe} {Лупа} + ::msgcat::mcset ua {To clipboard} {До буферу} + ::msgcat::mcset ua {Save} {Зберегти} + ::msgcat::mcset ua {Close} {Закрити} + ::msgcat::mcset ua {Size} {Розмір} + ::msgcat::mcset ua {Zoom} {Масштаб} + ::msgcat::mcset ua {Save the Loupe} {Зберегти зображення} + ::msgcat::mcset ua "Click the magnified image\nto get a pixel's color.\n\nThen hit this button." "Кликнить по картинці,\nщоб одержати колір піксела.\n\nПотім натиснить цю кнопку." + ::msgcat::mcset ua "Click, then drag and drop\nthe loupe to get the image." "Зачепить лупу мишею та тягніть ії по екрану.\n\nКоли відпустите мишу, одержите збільшене зображення." +} diff --git a/pkgIndex.tcl b/pkgIndex.tcl index 3117088..fc212a9 100644 --- a/pkgIndex.tcl +++ b/pkgIndex.tcl @@ -1,5 +1,5 @@ -package ifneeded aloupe 0.9.2 [list source [file join $dir aloupe.tcl]] +package ifneeded aloupe 0.9.4 [list source [file join $dir aloupe.tcl]] # A short intro (for Ruff! docs generator:) @@ -7,7 +7,7 @@ package ifneeded aloupe 0.9.2 [list source [file join $dir aloupe.tcl]] namespace eval aloupe { set _ruff_preamble { -The *aloupe v0.9.1* is a Tcl/Tk small widget / utility allowing to view the screen through a loupe. +The *aloupe v0.9.4* is a Tcl/Tk small widget / utility allowing to view the screen through a loupe. It allows also @@ -32,14 +32,14 @@ The *aloupe* utility runs with the command: where `option` may be `-size, -zoom, -alpha, -background, -geometry, -ontop`. -The `Img` and `treectrl` packages have to be installed to run it. In Debian Linux the packages are titled `libtk-img` and `tktreectrl`. +The `Img` and `treectrl` packages have to be installed to run it. In Debian Linux the packages are titled `libtk-img` and `tktreectrl`. If *aloupe* is run by a *tclkit* that doesn't provide these packages, define an environment variable `TCLLIBPATH` before running *aloupe* so that `TCLLIBPATH` be a list of pathes to the packages. There are also stand-alone [aloupe executables](https://github.com/aplsimple/aloupe/releases) for Linux / Windows. The executables are started as simply as: - aloupe - aloupe.exe + aloupe ?option value ...? + aloupe.exe ?option value ...? After the start, two windows would be displayed: a moveable loupe (at the mouse pointer) and a displaying window. @@ -65,15 +65,16 @@ The *aloupe* can be run with the options: * `-ontop` - if *yes* (default), sets the displaying window above others * `-save` - if *yes* (default), saves/restores the appearance settings * `-inifile` - a file to save the settings (~/.config/aloupe.conf by default) + * `-locale` - a preferable locale (e.g., ru, ua, cz) Some options can be used at running *aloupe* from a Tcl code: * `-exit` - is *false* which means "don't finish Tcl/Tk session, just close the loupe" * `-command` - a command to be run at pressing the *To clipboard* button - * `-commandname` - a label instead of *To clipboard*; means "no clipboard" + * `-commandname` - a label instead of *To clipboard*; when set it means also "no copy to clipboard" * `-parent` - a parent window's path (when the parent closes, its *aloupe* children do too) -From a Tcl code, *aloupe* is run this way: +From a Tcl code, *aloupe* widget is called this way: package require aloupe ::aloupe::run ?option value ...?