Advertisement
Guest User

gtrans_by_kulusz

a guest
Mar 19th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. list="<item>English [en]</item>
  4. <item>French [fr]</item>
  5. <item>Hungarian [hu]</item>
  6. "
  7.  
  8. mylist="$(echo $list)"
  9. mylast_to="$(echo $mylist)"
  10. mylast_from="$(echo $mylist)"
  11.  
  12. file_last_to="/tmp/last_to.txt"
  13. file_last_from="/tmp/last_from.txt"
  14.  
  15. if [ -e $file_last_to ]; then
  16. mylast_to="<item>"`cat "$file_last_to"`"</item>""$mylist"
  17. #else
  18. # mylist=$(cat "$file_lang")
  19. fi
  20. if [ -e $file_last_from ]; then
  21. mylast_from="<item>"`cat "$file_last_from"`"</item>""$mylist"
  22. #else
  23. # mylist=$(cat "$file_lang")
  24. fi
  25.  
  26. export MAIN='
  27. <vbox>
  28. <hbox>
  29. <text width-chars="5">
  30. <label>From:</label>
  31. </text>
  32. <combobox allow-empty="true" case-sensitive="true" value-in-list="true" tooltip-text="Source language">
  33. <variable>FROM</variable>
  34. '$mylast_from'
  35. </combobox>
  36. <text width-chars="5">
  37. <label>To:</label>
  38. </text>
  39. <combobox allow-empty="true" case-sensitive="true" value-in-list="true" tooltip-text="Target language">
  40. <variable>TO</variable>
  41. '$mylast_to'
  42. </combobox>
  43. </hbox>
  44.  
  45. <button tooltip-text="Swap languages">
  46. <label>"Swap"</label>
  47. <input file stock="gtk-refresh"></input>
  48. <action>echo $FROM > /tmp/last_to.txt</action>
  49. <action>echo $TO > /tmp/last_from.txt</action>
  50. <action>exit:SWAP</action>
  51. </button>
  52. <button tooltip-text="Close">
  53. <label>"Close"</label>
  54. <input file stock="gtk-quit"></input>
  55. <action>exit:CLOSE</action>
  56. </button>
  57.  
  58. </vbox>'
  59.  
  60. eval "`gtkdialog -p MAIN --center`"
  61.  
  62. if [ "$EXIT" == "SWAP" ];then
  63. "$0" && exit
  64. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement