aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/lang.tcl
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2017-02-09 04:37:26 -0500
committerLibravatarUnit 193 <unit193@ubuntu.com>2017-02-09 04:37:26 -0500
commitc9d6debf9015b7853c3e061bbc64a555d85e2fcd (patch)
tree53341bc57ae9fbad2beb5b6c08d97a68bee0ec8e /SQLiteStudio3/lang.tcl
parentd5caba2b1f36dc3b92fa705a06097d0597fa2ddd (diff)
parentd9aa870e5d509cc7309ab82dd102a937ab58613a (diff)
Merge tag 'upstream/3.1.1+dfsg1'
Upstream version 3.1.1+dfsg1 # gpg: Signature made Thu 09 Feb 2017 04:37:24 AM EST # gpg: using RSA key 5001E1B09AA3744B # gpg: issuer "unit193@ubuntu.com" # gpg: Good signature from "Unit 193 <unit193@ubuntu.com>" [unknown] # gpg: aka "Unit 193 <unit193@gmail.com>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 8DB3 E586 865D 2B4A 2B18 5A5C 5001 E1B0 9AA3 744B
Diffstat (limited to 'SQLiteStudio3/lang.tcl')
-rwxr-xr-xSQLiteStudio3/lang.tcl78
1 files changed, 72 insertions, 6 deletions
diff --git a/SQLiteStudio3/lang.tcl b/SQLiteStudio3/lang.tcl
index 4746a8d..d169450 100755
--- a/SQLiteStudio3/lang.tcl
+++ b/SQLiteStudio3/lang.tcl
@@ -71,7 +71,8 @@ switch -- $op {
if {$op == "update"} {
exec lupdate $f
} else {
- exec lrelease $f $::ERR_NULL
+ #exec lrelease $f $::ERR_NULL
+ exec lrelease $f
}
} res
if {$op == "release"} {
@@ -149,15 +150,18 @@ switch -- $op {
}
foreach p [list coreSQLiteStudio guiSQLiteStudio sqlitestudio sqlitestudiocli] {
+ # pro file
set fd [open $p/$p.pro r]
set data [read $fd]
close $fd
set ts "translations/${p}_$lang.ts"
- if {$op == "add"} {
+ if {$op == "add" && [string first $ts $data] == -1} {
set data [string map [list "TRANSLATIONS += " "TRANSLATIONS += $ts \\\n\t\t"] $data]
- } else {
+ } elseif {$op == "remove" && [string first $ts $data] > -1} {
regsub -- "$ts\\s*(\\\\)?\n\\s*" $data "" data
+ } else {
+ continue
}
set fd [open $p/$p.pro w+]
@@ -166,19 +170,46 @@ switch -- $op {
puts "Updated $p.pro"
}
+
+ foreach p [list coreSQLiteStudio guiSQLiteStudio sqlitestudio sqlitestudiocli] {
+ # qrc file
+ set fd [open $p/$p.qrc r]
+ set data [read $fd]
+ close $fd
+
+ set qm "translations/${p}_$lang.qm"
+ if {$op == "add" && [string first $qm $data] == -1} {
+ set data [string map [list "<qresource prefix=\"/msg\">" "<qresource prefix=\"/msg\">\n <file>$qm</file>"] $data]
+ } elseif {$op == "remove" && [string first $qm $data] > -1} {
+ regsub -- "\\s*$qm\\s*\n" $data "" data
+ } else {
+ continue
+ }
+
+ set fd [open $p/$p.qrc w+]
+ puts $fd $data
+ close $fd
+
+ puts "Updated $p.qrc"
+ }
foreach d [glob -directory ../Plugins -tails -nocomplain *] {
if {![file isdirectory ../Plugins/$d]} continue
+ # pro file
set fd [open ../Plugins/$d/$d.pro r]
set data [read $fd]
close $fd
-
+
+ if {[string first "TRANSLATIONS +=" $data] == -1} continue
+
set ts "${d}_$lang.ts"
- if {$op == "add"} {
+ if {$op == "add" && [string first $ts $data] == -1} {
set data [string map [list "TRANSLATIONS += " "TRANSLATIONS += $ts \\\n\t\t"] $data]
- } else {
+ } elseif {$op == "remove" && [string first $ts $data] > -1} {
regsub -- "$ts\\s*(\\\\)?\n\\s*" $data "" data
+ } else {
+ continue
}
set fd [open ../Plugins/$d/$d.pro w+]
@@ -187,6 +218,41 @@ switch -- $op {
puts "Updated $d.pro"
}
+
+ foreach d [glob -directory ../Plugins -tails -nocomplain *] {
+ # qrc file
+ if {![file isdirectory ../Plugins/$d]} continue
+ if {[file exists ../Plugins/$d/$d.qrc]} {
+ set fname ../Plugins/$d/$d.qrc
+ set fnameOnly $d.qrc
+ } elseif {[file exists ../Plugins/$d/[string tolower $d].qrc]} {
+ set fname ../Plugins/$d/[string tolower $d].qrc
+ set fnameOnly [string tolower $d].qrc
+ } else {
+ continue
+ }
+
+ set fd [open $fname r]
+ set data [read $fd]
+ close $fd
+
+ if {[string first "<qresource prefix=\"/msg\">" $data] == -1} continue
+
+ set qm "${d}_$lang.qm"
+ if {$op == "add" && [string first $qm $data] == -1} {
+ set data [string map [list "<qresource prefix=\"/msg\">" "<qresource prefix=\"/msg\">\n <file>$qm</file>"] $data]
+ } elseif {$op == "remove" && [string first $qm $data] > -1} {
+ regsub -- "\\s*$qm\\s*\n" $data "" data
+ } else {
+ continue
+ }
+
+ set fd [open $fname w+]
+ puts $fd $data
+ close $fd
+
+ puts "Updated $fnameOnly"
+ }
}
default {
usage