Skip to content

Commit

Permalink
Add locales (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
mespina authored Nov 5, 2023
1 parent 6c401e2 commit 235cebf
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
3 changes: 3 additions & 0 deletions lib/sidecloq/web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Sidecloq
# Plugin for sidekiq-web
module Web
VIEW_PATH = File.expand_path('../../../web/views', __FILE__)
LOCALES = File.expand_path('../../../web/locales', __FILE__)

def self.registered(app)
app.get '/recurring' do
Expand All @@ -24,5 +25,7 @@ def self.registered(app)
end
end

Sidekiq::Web.locales << Sidecloq::Web::LOCALES

Sidekiq::Web.register(Sidecloq::Web)
Sidekiq::Web.tabs['Recurring'] = 'recurring'
6 changes: 6 additions & 0 deletions web/locales/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
en:
RecurringJobs: Recurring Jobs
Recurring: Recurring
Name: Name
Cron: Cron
EnqueueNow: Enqueue Now
6 changes: 6 additions & 0 deletions web/locales/es.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
es:
RecurringJobs: Trabajos recurrentes
Recurring: Recurrentes
Name: Nombre
Cron: Cron
EnqueueNow: Poner en la cola ahora
16 changes: 8 additions & 8 deletions web/views/recurring.erb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<h3>Recurring Jobs</h3>
<h3><%= t('RecurringJobs') %></h3>

<div class="table_container">
<table class="table table-hover table-bordered table-striped table-white">
<thead>
<tr>
<th>Name</th>
<th>Cron</th>
<th>Class</th>
<th>Queue</th>
<th>Arguments</th>
<th>Actions</th>
<th><%= t('Name') %></th>
<th><%= t('Cron') %></th>
<th><%= t('Job') %></th>
<th><%= t('Queue') %></th>
<th><%= t('Arguments') %></th>
<th><%= t('Actions') %></th>
</tr>
</thead>

Expand All @@ -26,7 +26,7 @@
<td>
<form action="<%= root_path %>recurring/<%= CGI.escape(name).gsub('+', '%20') %>/enqueue" method="post">
<%= csrf_tag if respond_to?(:csrf_tag) %>
<input class='btn btn-primary btn-xs' type="submit" name="enque" value="<%= t('Enqueue Now') %>"/>
<input class='btn btn-primary btn-xs' type="submit" name="enque" value="<%= t('EnqueueNow') %>"/>
</form>
</td>
</tr>
Expand Down

0 comments on commit 235cebf

Please sign in to comment.