diff --git a/config/locales/en.yml b/config/locales/en.yml index 272910996..4157e4dc7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,2 +1,10 @@ en: - project_name: Project name \ No newline at end of file + project_name: Project name + project_version: Project version + generated_at: Generated at + generator: Generator + report_period: Report period + total_files: Total files + total_lines: Total lines + total_commits: Total commits + authors: Authors \ No newline at end of file diff --git a/lib/git_stats/cli.rb b/lib/git_stats/cli.rb index 2452b7b30..c62769ba0 100644 --- a/lib/git_stats/cli.rb +++ b/lib/git_stats/cli.rb @@ -3,9 +3,11 @@ require "git_stats" class GitStats::CLI def start(*args) - raise "Wrong number of arguments\nUsage: git_stats repo_path output_path" unless args.size == 2 + raise "Wrong number of arguments\nUsage: git_stats repo_path output_path " unless [2, 3].include? args.size + + repo_path, out_path, lang = args + I18n.locale = lang || :en - repo_path, out_path = args GitStats::Generator.new(repo_path, out_path) { |g| g.add_command_observer { |command, result| puts "#{command}" } }.render_all diff --git a/templates/index.haml b/templates/index.haml index d9377d158..5a7b6d204 100644 --- a/templates/index.haml +++ b/templates/index.haml @@ -3,26 +3,26 @@ %td= :project_name.t %td= repo.project_name %tr - %td Project version + %td= :project_version.t %td= repo.project_version %tr - %td Generated at + %td= :generated_at.t %td= DateTime.now.to_formatted_s(:long) %tr - %td Generator + %td= :generator.t %td= "GitStats #{GitStats::VERSION}" %tr - %td Report period + %td= :report_period.t %td= repo.commits_period.map {|d| d.to_formatted_s(:long)}.join(" .. ") %tr - %td Total files + %td= :total_files.t %td= repo.files_count %tr - %td Total lines + %td= :total_lines.t %td= "#{repo.lines_count} lines (#{repo.short_stats.map(&:insertions).sum} insertions, #{repo.short_stats.map(&:deletions).sum} deletions)" %tr - %td Total commits + %td= :total_commits.t %td= repo.commits.size %tr - %td Authors + %td= :authors.t %td= repo.authors.size