-desc 'Load Redmine default configuration data'\r
+desc 'Load Redmine default configuration data. Language is chosen interactively or by setting REDMINE_LANG environment variable.'\r
\r
namespace :redmine do\r
task :load_default_data => :environment do\r
include Redmine::I18n\r
set_language_if_valid('en')\r
- puts\r
\r
- while true\r
- print "Select language: "\r
- print valid_languages.collect(&:to_s).sort.join(", ")\r
- print " [#{current_language}] "\r
+ envlang = ENV['REDMINE_LANG']\r
+ if !envlang || !set_language_if_valid(envlang)\r
+ puts\r
+ while true\r
+ print "Select language: "\r
+ print valid_languages.collect(&:to_s).sort.join(", ")\r
+ print " [#{current_language}] "\r
+ STDOUT.flush\r
+ lang = STDIN.gets.chomp!\r
+ break if lang.empty?\r
+ break if set_language_if_valid(lang)\r
+ puts "Unknown language!"\r
+ end\r
STDOUT.flush\r
- lang = STDIN.gets.chomp!\r
- break if lang.empty?\r
- break if set_language_if_valid(lang)\r
- puts "Unknown language!"\r
+ puts "===================================="\r
end\r
\r
- puts "===================================="\r
- \r
begin\r
Redmine::DefaultData::Loader.load(current_language)\r
puts "Default configuration data loaded."\r