Skip to content

Commit

Permalink
I18n-tasks configuration (#740)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksierks authored Sep 9, 2024
1 parent c01473f commit 4439ebd
Show file tree
Hide file tree
Showing 53 changed files with 3,062 additions and 3,700 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ group :development do

# Solargraph
gem 'solargraph'

# i18n-tasks
gem 'i18n-tasks', '~> 1.0.14'
end

group :test do
Expand Down
18 changes: 18 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,24 @@ GEM
hana (1.3.7)
hashdiff (1.1.1)
hashie (5.0.0)
highline (3.1.0)
reline
holidays (8.8.0)
htmlbeautifier (1.4.3)
htmlentities (4.3.4)
httpclient (2.8.3)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
i18n-tasks (1.0.14)
activesupport (>= 4.0.2)
ast (>= 2.1.0)
erubi
highline (>= 2.0.0)
i18n
parser (>= 3.2.2.1)
rails-i18n
rainbow (>= 2.2.2, < 4.0)
terminal-table (>= 1.5.1)
importmap-rails (2.0.1)
actionpack (>= 6.0.0)
activesupport (>= 6.0.0)
Expand Down Expand Up @@ -445,6 +457,9 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
rails-i18n (7.0.9)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
railties (7.2.0)
actionpack (= 7.2.0)
activesupport (= 7.2.0)
Expand Down Expand Up @@ -576,6 +591,8 @@ GEM
railties (>= 7.0.0)
tailwindcss-rails (2.7.3-x86_64-linux)
railties (>= 7.0.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
thor (1.3.1)
tilt (2.4.0)
timecop (0.9.10)
Expand Down Expand Up @@ -661,6 +678,7 @@ DEPENDENCIES
graphiql-rails
graphql
holidays
i18n-tasks (~> 1.0.14)
importmap-rails
jbuilder
listen
Expand Down
7 changes: 0 additions & 7 deletions app/components/groups/table_component.en.yml

This file was deleted.

7 changes: 0 additions & 7 deletions app/components/groups/table_component.fr.yml

This file was deleted.

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions app/components/nextflow/samplesheet/column_component.en.yml

This file was deleted.

5 changes: 0 additions & 5 deletions app/components/nextflow/samplesheet/column_component.fr.yml

This file was deleted.

3 changes: 0 additions & 3 deletions app/components/nextflow/samplesheet_component.en.yml

This file was deleted.

3 changes: 0 additions & 3 deletions app/components/nextflow/samplesheet_component.fr.yml

This file was deleted.

4 changes: 0 additions & 4 deletions app/components/nextflow_component.en.yml

This file was deleted.

4 changes: 0 additions & 4 deletions app/components/nextflow_component.fr.yml

This file was deleted.

14 changes: 0 additions & 14 deletions app/components/samples/table_component.en.yml

This file was deleted.

14 changes: 0 additions & 14 deletions app/components/samples/table_component.fr.yml

This file was deleted.

2 changes: 0 additions & 2 deletions app/components/viral/form/select_component.en.yml

This file was deleted.

2 changes: 0 additions & 2 deletions app/components/viral/form/select_component.fr.yml

This file was deleted.

5 changes: 0 additions & 5 deletions app/components/viral/pagy/limit_component.en.yml

This file was deleted.

5 changes: 0 additions & 5 deletions app/components/viral/pagy/limit_component.fr.yml

This file was deleted.

4 changes: 0 additions & 4 deletions app/components/viral/pagy/pagination_component.en.yml

This file was deleted.

4 changes: 0 additions & 4 deletions app/components/viral/pagy/pagination_component.fr.yml

This file was deleted.

14 changes: 0 additions & 14 deletions app/components/workflow_executions/table_component.en.yml

This file was deleted.

14 changes: 0 additions & 14 deletions app/components/workflow_executions/table_component.fr.yml

This file was deleted.

4 changes: 2 additions & 2 deletions app/controllers/concerns/bot_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def create # rubocop:disable Metrics/MethodLength
if @new_bot_account[:bot_user_account].persisted?
render status: :ok, locals: {
type: 'success',
message: t('.success'),
message: t('concerns.bot_actions.create.success'),
personal_access_token: @new_bot_account[:personal_access_token]
}
else
Expand All @@ -60,7 +60,7 @@ def destroy # rubocop:disable Metrics/MethodLength
if @bot_account.deleted?
render status: :ok, locals: {
type: 'success',
message: t('.success')
message: t('concerns.bot_actions.destroy.success')
}
else
render status: :unprocessable_entity,
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/concerns/bot_personal_access_token_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def create # rubocop:disable Metrics/MethodLength
if @personal_access_token.persisted?
render status: :ok, locals: {
type: 'success',
message: t('.success'),
message: t('concerns.bot_personal_access_token_actions.create.success'),
personal_access_token: @personal_access_token
}
else
Expand All @@ -61,7 +61,7 @@ def revoke
if @personal_access_token.revoke!
render status: :ok, locals: {
personal_access_token: @personal_access_token, type: 'success',
message: t('.success', pat_name: @personal_access_token.name)
message: t('concerns.bot_personal_access_token_actions.revoke.success', pat_name: @personal_access_token.name)
}
else
render status: :unprocessable_entity, locals: { type: 'alert',
Expand Down
5 changes: 3 additions & 2 deletions app/controllers/concerns/file_import_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ def create
@imported_metadata = ::Samples::Metadata::FileImportService.new(@namespace, current_user,
file_import_params).execute
if @namespace.errors.empty?
render status: :ok, locals: { type: :success, message: t('.success') }
render status: :ok, locals: { type: :success, message: t('concerns.file_import_actions.create.success') }
elsif @namespace.errors.include?(:sample)
errors = @namespace.errors.messages_for(:sample)
render status: :partial_content, locals: { type: :alert, message: t('.error'), errors: }
render status: :partial_content,
locals: { type: :alert, message: t('concerns.file_import_actions.create.error'), errors: }
else
error = @namespace.errors.full_messages_for(:base).first
render status: :unprocessable_entity, locals: { type: :danger, message: error }
Expand Down
13 changes: 8 additions & 5 deletions app/controllers/concerns/membership_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def create # rubocop:disable Metrics/MethodLength
respond_to do |format|
format.turbo_stream do
render status: :ok, locals: { member: @new_member, type: 'success',
message: t('.success', user: @new_member.user.email) }
message: t('concerns.membership_actions.create.success',
user: @new_member.user.email) }
end
end
else
Expand All @@ -60,7 +61,7 @@ def destroy # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/Per

if @member.deleted?
if current_user == @member.user
flash[:success] = t('.leave_success', name: @namespace.name)
flash[:success] = t('concerns.membership_actions.destroy.leave_success', name: @namespace.name)
if @namespace.group_namespace?
redirect_to dashboard_groups_path(format: :html)
else
Expand All @@ -70,7 +71,8 @@ def destroy # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/Per
respond_to do |format|
format.turbo_stream do
render status: :ok, locals: { member: @member, type: 'success',
message: t('.success', user: @member.user.email) }
message: t('concerns.membership_actions.destroy.success',
user: @member.user.email) }
end
end
end
Expand All @@ -91,13 +93,14 @@ def destroy # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/Per
end
end

def update
def update # rubocop:disable Metrics/MethodLength
updated = Members::UpdateService.new(@member, @namespace, current_user, member_params).execute
respond_to do |format|
if updated
format.turbo_stream do
render status: :ok, locals: { member: @member, access_levels: @access_levels, type: 'success',
message: t('.success', user_email: @member.user.email) }
message: t('concerns.membership_actions.update.success',
user_email: @member.user.email) }
end
else
format.turbo_stream do
Expand Down
22 changes: 12 additions & 10 deletions app/controllers/concerns/share_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def create # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
locals: { namespace_group_link: @created_namespace_group_link,
access_levels: @access_levels,
type: 'success',
message: t('.success',
message: t('concerns.share_actions.create.success',
namespace_name: @created_namespace_group_link.namespace.human_name,
group_name: @created_namespace_group_link.group.human_name) }
end
Expand All @@ -65,8 +65,9 @@ def destroy # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
if @namespace_group_link.deleted?
format.turbo_stream do
render status: :ok, locals: { namespace_group_link: @namespace_group_link, type: 'success',
message: t('.success', namespace_name: @namespace.human_name,
group_name: @namespace_group_link.group.human_name) }
message: t('concerns.share_actions.destroy.success',
namespace_name: @namespace.human_name,
group_name: @namespace_group_link.group.human_name) }
end
else
format.turbo_stream do
Expand All @@ -79,7 +80,7 @@ def destroy # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
format.turbo_stream do
render status: :bad_request,
locals: { type: 'alert',
message: t('error') }
message: t('concerns.share_actions.destroy.error') }
end
end
end
Expand All @@ -88,9 +89,9 @@ def destroy # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
def update # rubocop:disable Metrics/MethodLength
@updated = GroupLinks::GroupLinkUpdateService.new(current_user, @namespace_group_link, group_link_params).execute
updated_param = if group_link_params[:group_access_level].nil?
t('.params.expiration_date')
t('concerns.share_actions.update.params.expiration_date')
else
t('.params.group_access_level')
t('concerns.share_actions.update.params.group_access_level')
end

respond_to do |format|
Expand All @@ -99,15 +100,16 @@ def update # rubocop:disable Metrics/MethodLength
render status: :ok, locals: { namespace_group_link: @namespace_group_link,
access_levels: @access_levels,
type: 'success',
message: t('.success', namespace_name: @namespace.human_name,
group_name: @namespace_group_link.group.human_name,
param_name: updated_param) }
message: t('concerns.share_actions.update.success',
namespace_name: @namespace.human_name,
group_name: @namespace_group_link.group.human_name,
param_name: updated_param) }
end
else
format.turbo_stream do
render status: :unprocessable_entity,
locals: { namespace_group_link: @namespace_group_link, type: 'alert',
message: t('.error') }
message: t('concerns.share_actions.update.error') }
end
end
end
Expand Down
Loading

0 comments on commit 4439ebd

Please sign in to comment.