1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Initial i18n work, still need many English strings extracted [#811]

This commit is contained in:
Mike Perham 2013-04-03 21:26:44 -07:00
parent c5cc486987
commit d12b00b359
10 changed files with 61 additions and 26 deletions

View file

@ -1,3 +1,11 @@
2.10.0
-----------
- I18n for web UI. Please submit translations of `web/locales/en.yml` for
your own language. [#811]
- 'sinatra', 'slim' and 'i18n' are now gem dependencies for Sidekiq.
2.9.0
-----------

View file

@ -1,3 +1,3 @@
module Sidekiq
VERSION = "2.9.0"
VERSION = "2.10.0"
end

View file

@ -1,18 +1,28 @@
require 'sinatra/base'
require 'slim'
require 'sidekiq/paginator'
require 'i18n'
module Sidekiq
class Web < Sinatra::Base
include Sidekiq::Paginator
dir = File.expand_path(File.dirname(__FILE__) + "/../../web")
I18n.load_path += Dir[File.join(dir, 'locales', '*.yml').to_s]
set :public_folder, "#{dir}/assets"
set :views, "#{dir}/views"
set :root, "#{dir}/public"
set :slim, :pretty => true
helpers do
def get_locale
(request.env["HTTP_ACCEPT_LANGUAGE"] || 'en')[0,2]
end
def t(msg)
I18n.t(msg, :locale => get_locale)
end
def reset_worker_list
Sidekiq.redis do |conn|

View file

@ -19,9 +19,10 @@ Gem::Specification.new do |gem|
gem.add_dependency 'connection_pool', '~> 1.0'
gem.add_dependency 'celluloid', '~> 0.12.0'
gem.add_dependency 'multi_json', '~> 1'
gem.add_dependency 'sinatra'
gem.add_dependency 'slim'
gem.add_dependency 'i18n'
gem.add_development_dependency 'minitest', '~> 4'
gem.add_development_dependency 'sinatra'
gem.add_development_dependency 'slim'
gem.add_development_dependency 'rake'
gem.add_development_dependency 'actionmailer', '~> 3'
gem.add_development_dependency 'activerecord', '~> 3'

16
web/locales/en.yml Normal file
View file

@ -0,0 +1,16 @@
en:
Dashboard: Dashboard
Realtime: Real-time
History: History
Busy: Busy
Processed: Processed
Failed: Failed
Scheduled: Scheduled
Retries: Retries
Enqueued: Enqueued
Worker: Worker
Queue: Queue
Class: Class
Arguments: Arguments
Started: Started
ShowAll: Show All

View file

@ -1,19 +1,19 @@
ul.unstyled.summary
li.processed
span.count #{number_with_delimiter(stats.processed)}
span.desc Processed
span.desc = t('Processed')
li.failed
span.count #{number_with_delimiter(stats.failed)}
span.desc Failed
span.desc = t('Failed')
li.busy
span.count #{number_with_delimiter(workers.size)}
span.desc Busy
span.desc = t('Busy')
li.scheduled
span.count #{number_with_delimiter(stats.scheduled_size)}
span.desc Scheduled
span.desc = t('Scheduled')
li.retries
span.count #{number_with_delimiter(stats.retry_size)}
span.desc Retries
span.desc = t('Retries')
li.enqueued
span.count #{number_with_delimiter(stats.enqueued)}
span.desc Enqueued
span.desc = t('Enqueued')

View file

@ -1,10 +1,10 @@
table class="workers table table-hover table-bordered table-striped table-white"
thead
th Worker
th Queue
th Class
th Arguments
th Started
th = t('Worker')
th = t('Queue')
th = t('Class')
th = t('Arguments')
th = t('Started')
- workers.each_with_index do |(worker, msg), index|
tr
td= worker
@ -14,7 +14,7 @@ table class="workers table table-hover table-bordered table-striped table-white"
td
- if msg['payload']['args'].to_s.size > 100
= msg['payload']['args'].inspect[0..100] + "... "
button data-toggle="collapse" data-target="#worker_#{index}" class="btn btn-mini" Show All
button data-toggle="collapse" data-target="#worker_#{index}" class="btn btn-mini" = t('ShowAll')
.toggle[id="worker_#{index}" style="display: none;max-width: 750px;"]= msg['payload']['args']
- else
= msg['payload']['args']

View file

@ -1,16 +1,16 @@
script type="text/javascript" src="#{{root_path}}javascripts/dashboard.js"
h3
| Dashboard
= t('Dashboard')
span.beacon
.ring
.dot
h5 Real-time
h5 = t('Realtime')
#realtime
h5
span.history-heading History
span.history-heading = t('History')
a href="#{{root_path}}?days=7" class="history-graph #{{"active" if params[:days] == "7"}}" 1 week
a href="#{{root_path}}" class="history-graph #{{"active" if params[:days].nil? || params[:days] == "30"}}" 1 month
a href="#{{root_path}}?days=90" class="history-graph #{{"active" if params[:days] == "90"}}" 3 month
@ -43,4 +43,4 @@ h5 Redis
- if @redis_info.fetch("used_memory_peak_human", nil)
.stat
h3.used_memory_peak_human= @redis_info.fetch("used_memory_peak_human")
p Peak Memory Usage
p Peak Memory Usage

View file

@ -1,10 +1,10 @@
.row.header
.span7
h3 Workers
h3 = t('Workers')
== slim :_workers
- if workers.size > 0
.row
.span2.pull-right
form action="#{root_path}reset" method="post"
button.btn.btn-primary.btn-block type="submit" title="If you kill -9 Sidekiq, this table can fill up with old data." Clear Worker List
button.btn.btn-primary.btn-block type="submit" title="#{t('Kill9Warning')}" = t('ClearWorkerList')

View file

@ -23,26 +23,26 @@ html
li
p.navbar-text Redis: #{location}
li
p.navbar-text Time: #{Time.now.utc.strftime('%H:%M:%S UTC')}
p.navbar-text #{t('Time')}: #{Time.now.utc.strftime('%H:%M:%S UTC')}
- if namespace
li
p.navbar-text Namespace: #{namespace}
p.navbar-text #{t('Namespace')}: #{namespace}
#page
.container
.row
.span2.summary_bar
h4
span.title Status
span.title = t('Status')
== slim :_status
== slim :_summary
- unless current_path == ''
.row
.span2
- if params[:poll]
a#live-poll.btn.btn-block.btn-primary.active href='#{{root_path}}#{{current_path}}' Stop Polling
a#live-poll.btn.btn-block.btn-primary.active href='#{{root_path}}#{{current_path}}' = t('StopPolling')
- else
a#live-poll.btn.btn-block.btn-primary href='#{{root_path}}#{{current_path}}?poll=true' Live Poll
a#live-poll.btn.btn-block.btn-primary href='#{{root_path}}#{{current_path}}?poll=true' = t('LivePoll')
.span10
== yield