loader.tcl 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ###############
  2. ################################################################
  3. #
  4. ##### LANGUAGE MODULE
  5. ### This is the language loader for BlackTools.tcl
  6. #
  7. ### it'll provide replies/notices in diff languages.
  8. ### The default lang can be set in BlackTools.tcl
  9. #
  10. ## 1 - Romanian
  11. ## 2 - English
  12. ## 3 - Italian (not available)
  13. ## 4 - Spanish (not available)
  14. ## 5 - French (not available)
  15. # ###############
  16. ################################################################
  17. #load language
  18. set get_lang_files [glob -directory "$black(dirname)/BlackTools/lang" "*.??.lang.tcl"]
  19. foreach lang $get_lang_files {
  20. set black(lang_error_$lang) [catch {source $lang} black(lang_error_stats_$lang)]
  21. if {$black(lang_error_$lang) == "1"} {
  22. putlog "\[BT\] :Couldn't load the lang file \"$lang\".Reason: \"$black(lang_error_stats_$lang)\""
  23. } else {
  24. set split_lang [split $lang "."]
  25. set the_lang [lindex $split_lang 1]
  26. lappend black(current_lang) [join $the_lang ","]
  27. }
  28. if {![info exists black(current_lang) ]} {set black(current_lang) "N/A"}
  29. }
  30. #load manual
  31. set get_man_files [glob -directory "$black(dirname)/BlackTools/lang" "*.???-??.lang.tcl"]
  32. foreach lang $get_man_files {
  33. set black(man_error_$lang) [catch {source $lang} black(man_error_stats_$lang)]
  34. if {$black(man_error_$lang) == "1"} {
  35. putlog "\[BT\] :Couldn't load the manual file \"$lang\".Reason: \"$black(man_error_stats_$lang)\""
  36. }
  37. }
  38. ###############
  39. ################################################################
  40. # END #
  41. ################################################################