Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix/replace custom i18n function (#8681)

ulferts5968c0b18aa8
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
index 2fa70f7709e..67d9025db2c 100644
--- a/app/controllers/account_controller.rb
+++ b/app/controllers/account_controller.rb
@@ -96,7 +96,7 @@ class AccountController < ApplicationController
# Ensure the same request is sent regardless of which email is entered
# to avoid detecability of mails
- flash[:notice] = l(:notice_account_lost_email_sent)
+ flash[:notice] = I18n.t(:notice_account_lost_email_sent)
unless user
# user not found in db
@@ -114,7 +114,7 @@ class AccountController < ApplicationController
token = Token::Recovery.new(user_id: user.id)
if token.save
UserMailer.password_lost(token).deliver_later
- flash[:notice] = l(:notice_account_lost_email_sent)
+ flash[:notice] = I18n.t(:notice_account_lost_email_sent)
redirect_to action: 'login', back_url: home_url
return
end
diff --git a/app/controllers/auth_sources_controller.rb b/app/controllers/auth_sources_controller.rb
index f2a2090b51c..3809883d5a5 100644
--- a/app/controllers/auth_sources_controller.rb
+++ b/app/controllers/auth_sources_controller.rb
@@ -49,7 +49,7 @@ class AuthSourcesController < ApplicationController
def create
@auth_source = auth_source_class.new permitted_params.auth_source
if @auth_source.save
- flash[:notice] = l(:notice_successful_create)
+ flash[:notice] = I18n.t(:notice_successful_create)
redirect_to action: 'index'
else
render 'auth_sources/new'
@@ -67,7 +67,7 @@ class AuthSourcesController < ApplicationController
updated.delete :account_password if updated[:account_password].blank?
if @auth_source.update updated
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_to action: 'index'
else
render 'auth_sources/edit'
@@ -78,9 +78,9 @@ class AuthSourcesController < ApplicationController
@auth_method = AuthSource.find(params[:id])
begin
@auth_method.test_connection
- flash[:notice] = l(:notice_successful_connection)
+ flash[:notice] = I18n.t(:notice_successful_connection)
rescue => text
- flash[:error] = l(:error_unable_to_connect, text.message)
+ flash[:error] = I18n.t(:error_unable_to_connect, value: text.message)
end
redirect_to action: 'index'
end
diff --git a/app/controllers/authentication_controller.rb b/app/controllers/authentication_controller.rb
index c5ae3aa0f5e..f3bb25bddf5 100644
--- a/app/controllers/authentication_controller.rb
+++ b/app/controllers/authentication_controller.rb
@@ -44,7 +44,7 @@ class AuthenticationController < ApplicationController
.new(user: current_user)
.call(settings: permitted_params.settings.to_h)
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_to action: 'authentication_settings'
end
end
diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb
index ef706a64621..227c64c7d08 100644
--- a/app/controllers/categories_controller.rb
+++ b/app/controllers/categories_controller.rb
@@ -46,7 +46,7 @@ class CategoriesController < ApplicationController
if @category.save
respond_to do |format|
format.html do
- flash[:notice] = l(:notice_successful_create)
+ flash[:notice] = I18n.t(:notice_successful_create)
redirect_to settings_categories_project_path(@project)
end
format.js do
@@ -68,7 +68,7 @@ class CategoriesController < ApplicationController
def update
@category.attributes = permitted_params.category
if @category.save
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_to settings_categories_project_path(@project)
else
render action: 'edit'
diff --git a/app/controllers/colors_controller.rb b/app/controllers/colors_controller.rb
index 0db4081cc03..463f6b6b2dd 100644
--- a/app/controllers/colors_controller.rb
+++ b/app/controllers/colors_controller.rb
@@ -58,10 +58,10 @@ class ColorsController < ApplicationController
@color = Color.new(permitted_params.color)
if @color.save
- flash[:notice] = l(:notice_successful_create)
+ flash[:notice] = I18n.t(:notice_successful_create)
redirect_to colors_path
else
- flash.now[:error] = l('timelines.color_could_not_be_saved')
+ flash.now[:error] = I18n.t('timelines.color_could_not_be_saved')
render action: 'new'
end
end
@@ -77,10 +77,10 @@ class ColorsController < ApplicationController
@color = Color.find(params[:id])
if @color.update(permitted_params.color)
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_to colors_path
else
- flash.now[:error] = l('timelines.color_could_not_be_saved')
+ flash.now[:error] = I18n.t('timelines.color_could_not_be_saved')
render action: 'edit'
end
end
@@ -96,7 +96,7 @@ class ColorsController < ApplicationController
@color = Color.find(params[:id])
@color.destroy
- flash[:notice] = l(:notice_successful_delete)
+ flash[:notice] = I18n.t(:notice_successful_delete)
redirect_to colors_path
end
diff --git a/app/controllers/concerns/accounts/user_password_change.rb b/app/controllers/concerns/accounts/user_password_change.rb
index cfcae3f9a91..9cc8c6d06a6 100644
--- a/app/controllers/concerns/accounts/user_password_change.rb
+++ b/app/controllers/concerns/accounts/user_password_change.rb
@@ -92,7 +92,7 @@ module Accounts::UserPasswordChange
if user and not user.change_password_allowed?
logger.warn "Password change for user '#{user}' forced, but user is not allowed " +
'to change password'
- flash[:error] = l(:notice_can_t_change_password)
+ flash[:error] = I18n.t(:notice_can_t_change_password)
redirect_to action: 'login'
return true
end
diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rb
index 67b37fcdea0..f76b869e6e1 100644
--- a/app/controllers/custom_fields_controller.rb
+++ b/app/controllers/custom_fields_controller.rb
@@ -90,7 +90,7 @@ class CustomFieldsController < ApplicationController
begin
@custom_field.destroy
rescue
- flash[:error] = l(:error_can_not_delete_custom_field)
+ flash[:error] = I18n.t(:error_can_not_delete_custom_field)
end
redirect_to custom_fields_path(tab: @custom_field.class.name)
end
diff --git a/app/controllers/enumerations_controller.rb b/app/controllers/enumerations_controller.rb
index 7990fc94b92..59e24fae51a 100644
--- a/app/controllers/enumerations_controller.rb
+++ b/app/controllers/enumerations_controller.rb
@@ -56,7 +56,7 @@ class EnumerationsController < ApplicationController
end
if @enumeration.save
- flash[:notice] = l(:notice_successful_create)
+ flash[:notice] = I18n.t(:notice_successful_create)
redirect_to action: 'index', type: @enumeration.type
else
render action: 'new'
@@ -68,7 +68,7 @@ class EnumerationsController < ApplicationController
type = permitted_params.enumeration_type
@enumeration.type = enumeration_class(type).try(:name) || @enumeration.type
if @enumeration.update enum_params
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_to enumerations_path(type: @enumeration.type)
else
render action: 'edit'
diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb
index 1ecf22fbba0..ffaea91cb11 100644
--- a/app/controllers/forums_controller.rb
+++ b/app/controllers/forums_controller.rb
@@ -89,7 +89,7 @@ class ForumsController < ApplicationController
def create
if @forum.save
- flash[:notice] = l(:notice_successful_create)
+ flash[:notice] = I18n.t(:notice_successful_create)
redirect_to action: 'index'
else
render :new
@@ -100,7 +100,7 @@ class ForumsController < ApplicationController
def update
if @forum.update(permitted_params.forum)
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_to action: 'index'
else
render :edit
@@ -119,7 +119,7 @@ class ForumsController < ApplicationController
def destroy
@forum.destroy
- flash[:notice] = l(:notice_successful_delete)
+ flash[:notice] = I18n.t(:notice_successful_delete)
redirect_to action: 'index'
end
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index 04e26a70a20..431ca165fc1 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -82,7 +82,7 @@ class GroupsController < ApplicationController
respond_to do |format|
if @group.save
- flash[:notice] = l(:notice_successful_create)
+ flash[:notice] = I18n.t(:notice_successful_create)
format.html do redirect_to(groups_path) end
format.xml do render xml: @group, status: :created, location: @group end
else
@@ -99,7 +99,7 @@ class GroupsController < ApplicationController
respond_to do |format|
if @group.update(permitted_params.group)
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
format.html do redirect_to(groups_path) end
format.xml do head :ok end
else
@@ -115,7 +115,7 @@ class GroupsController < ApplicationController
@group.destroy
respond_to do |format|
- flash[:notice] = l(:notice_successful_delete)
+ flash[:notice] = I18n.t(:notice_successful_delete)
format.html do redirect_to(groups_url) end
format.xml do head :ok end
end
diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb
index 9fae33c548a..c8fbad33545 100644
--- a/app/controllers/journals_controller.rb
+++ b/app/controllers/journals_controller.rb
@@ -48,13 +48,11 @@ class JournalsController < ApplicationController
limit: 25)
end
- title = (@project ? @project.name : Setting.app_title) + ': ' + (@query.new_record? ? l(:label_changes_details) : @query.name)
-
respond_to do |format|
format.atom do
render layout: false,
content_type: 'application/atom+xml',
- locals: { title: title,
+ locals: { title: journals_index_title,
journals: @journals }
end
end
@@ -105,4 +103,8 @@ class JournalsController < ApplicationController
valid_field?(params[:field]) &&
@journal.journable.class == WorkPackage
end
+
+ def journals_index_title
+ (@project ? @project.name : Setting.app_title) + ': ' + (@query.new_record? ? I18n.t(:label_changes_details) : @query.name)
+ end
end
diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb
index 85ec91d5e7f..6a67652abd3 100644
--- a/app/controllers/members_controller.rb
+++ b/app/controllers/members_controller.rb
@@ -74,7 +74,7 @@ class MembersController < ApplicationController
member = update_member_from_params
if member.save
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
else
# only possible message is about choosing at least one role
flash[:error] = member.errors.full_messages.first
@@ -291,9 +291,9 @@ class MembersController < ApplicationController
def members_added_notice(members)
if members.size == 1
- l(:notice_member_added, name: members.first.name)
+ I18n.t(:notice_member_added, name: members.first.name)
else
- l(:notice_members_added, number: members.size)
+ I18n.t(:notice_members_added, number: members.size)
end
end
end
diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb
index 1113ceb3403..d3818b0c6f8 100644
--- a/app/controllers/my_controller.rb
+++ b/app/controllers/my_controller.rb
@@ -123,7 +123,7 @@ class MyController < ApplicationController
end
def default_breadcrumb
- l(:label_my_account)
+ I18n.t(:label_my_account)
end
def show_local_breadcrumb
@@ -134,7 +134,7 @@ class MyController < ApplicationController
def redirect_if_password_change_not_allowed_for(user)
unless user.change_password_allowed?
- flash[:error] = l(:notice_can_t_change_password)
+ flash[:error] = I18n.t(:notice_can_t_change_password)
redirect_to action: 'account'
return true
end
@@ -146,7 +146,7 @@ class MyController < ApplicationController
if update_service.call(mail_notification: permitted_params.user[:mail_notification],
self_notified: params[:self_notified] == '1',
notified_project_ids: params[:notified_project_ids])
- flash[:notice] = l(:notice_account_updated)
+ flash[:notice] = I18n.t(:notice_account_updated)
redirect_to(action: redirect_to)
end
end
diff --git a/app/controllers/news/comments_controller.rb b/app/controllers/news/comments_controller.rb
index c7739b4a50b..70157f4efec 100644
--- a/app/controllers/news/comments_controller.rb
+++ b/app/controllers/news/comments_controller.rb
@@ -37,7 +37,7 @@ class News::CommentsController < ApplicationController
@comment = Comment.new(permitted_params.comment)
@comment.author = User.current
if @news.comments << @comment
- flash[:notice] = l(:label_comment_added)
+ flash[:notice] = I18n.t(:label_comment_added)
end
redirect_to news_path(@news)
diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb
index 2df59b001c3..4a93673ef41 100644
--- a/app/controllers/news_controller.rb
+++ b/app/controllers/news_controller.rb
@@ -54,7 +54,7 @@ class NewsController < ApplicationController
end
format.atom do
render_feed(@newss,
- title: (@project ? @project.name : Setting.app_title) + ": #{l(:label_news_plural)}")
+ title: (@project ? @project.name : Setting.app_title) + ": #{I18n.t(:label_news_plural)}")
end
end
end
@@ -76,7 +76,7 @@ class NewsController < ApplicationController
@news = News.new(project: @project, author: User.current)
@news.attributes = permitted_params.news
if @news.save
- flash[:notice] = l(:notice_successful_create)
+ flash[:notice] = I18n.t(:notice_successful_create)
redirect_to controller: '/news', action: 'index', project_id: @project
else
render action: 'new'
@@ -88,7 +88,7 @@ class NewsController < ApplicationController
def update
@news.attributes = permitted_params.news
if @news.save
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_to action: 'show', id: @news
else
render action: 'edit'
@@ -97,7 +97,7 @@ class NewsController < ApplicationController
def destroy
@news.destroy
- flash[:notice] = l(:notice_successful_delete)
+ flash[:notice] = I18n.t(:notice_successful_delete)
redirect_to action: 'index', project_id: @project
end
diff --git a/app/controllers/onboarding_controller.rb b/app/controllers/onboarding_controller.rb
index 593550195c2..83d0df0502b 100644
--- a/app/controllers/onboarding_controller.rb
+++ b/app/controllers/onboarding_controller.rb
@@ -36,7 +36,7 @@ class OnboardingController < ApplicationController
.call(permitted_params, params)
if result.success?
- flash[:notice] = l(:notice_account_updated)
+ flash[:notice] = I18n.t(:notice_account_updated)
end
# Remove all query params:
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index f2da3ef0d53..8e2da8b6469 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -129,7 +129,7 @@ class ProjectsController < ApplicationController
def types
if UpdateProjectsTypesService.new(@project).call(permitted_params.projects_type_ids)
- flash[:notice] = l('notice_successful_update')
+ flash[:notice] = I18n.t('notice_successful_update')
else
flash[:error] = @project.errors.full_messages
end
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index ecb0c470cf5..20203532e6b 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -63,8 +63,8 @@ class RepositoriesController < ApplicationController
service = SCM::RepositoryFactoryService.new(@project, params)
if service.build_and_save
@repository = service.repository
- flash[:notice] = l('repositories.create_successful')
- flash[:notice] << (' ' + l('repositories.create_managed_delay')) if @repository.managed?
+ flash[:notice] = I18n.t('repositories.create_successful')
+ flash[:notice] << (' ' + I18n.t('repositories.create_managed_delay')) if @repository.managed?
else
flash[:error] = service.build_error
end
@@ -86,7 +86,7 @@ class RepositoriesController < ApplicationController
h[c.first] = c.last
h
}
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_to action: 'committers', project_id: @project
end
end
@@ -161,7 +161,7 @@ class RepositoriesController < ApplicationController
render layout: false if request.xhr?
end
format.atom do
- render_feed(@changesets, title: "#{@project.name}: #{l(:label_revision_plural)}")
+ render_feed(@changesets, title: "#{@project.name}: #{I18n.t(:label_revision_plural)}")
end
end
end
@@ -316,7 +316,7 @@ class RepositoriesController < ApplicationController
@repository.attributes = @repository.class.permitted_params(repo_params)
if @repository.save
- flash[:notice] = l('repositories.update_settings_successful')
+ flash[:notice] = I18n.t('repositories.update_settings_successful')
else
flash[:error] = @repository.errors.full_messages.join('\n')
end
@@ -355,11 +355,11 @@ class RepositoriesController < ApplicationController
end
def show_error_not_found
- render_error message: l(:error_scm_not_found), status: 404
+ render_error message: I18n.t(:error_scm_not_found), status: 404
end
def show_error_command_failed(exception)
- render_error l(:error_scm_command_failed, exception.message)
+ render_error I18n.t(:error_scm_command_failed, value: exception.message)
end
def graph_commits_per_month(repository)
@@ -399,18 +399,18 @@ class RepositoriesController < ApplicationController
scale_integers: true,
step_x_labels: 2,
show_data_values: false,
- graph_title: l(:label_commits_per_month),
+ graph_title: I18n.t(:label_commits_per_month),
show_graph_title: true
)
graph.add_data(
data: commits_by_month[0..11].reverse,
- title: l(:label_revision_plural)
+ title: I18n.t(:label_revision_plural)
)
graph.add_data(
data: changes_by_month[0..11].reverse,
- title: l(:label_change_plural)
+ title: I18n.t(:label_change_plural)
)
graph.burn
@@ -451,16 +451,16 @@ class RepositoriesController < ApplicationController
scale_integers: true,
show_data_values: false,
rotate_y_labels: false,
- graph_title: l(:label_commits_per_author),
+ graph_title: I18n.t(:label_commits_per_author),
show_graph_title: true
)
graph.add_data(
data: commits_data,
- title: l(:label_revision_plural)
+ title: I18n.t(:label_revision_plural)
)
graph.add_data(
data: changes_data,
- title: l(:label_change_plural)
+ title: I18n.t(:label_change_plural)
)
graph.burn
end
diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb
index 61c54a39b11..a540c0e99dd 100644
--- a/app/controllers/roles_controller.rb
+++ b/app/controllers/roles_controller.rb
@@ -73,7 +73,7 @@ class RolesController < ApplicationController
@call = update_role(@role, permitted_params.role)
if @call.success?
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_to action: 'index'
else
render action: 'edit'
@@ -83,11 +83,11 @@ class RolesController < ApplicationController
def destroy
@role = Role.find(params[:id])
@role.destroy
- flash[:notice] = l(:notice_successful_delete)
+ flash[:notice] = I18n.t(:notice_successful_delete)
redirect_to action: 'index'
notify_changed_roles(:removed, @role)
rescue
- flash[:error] = l(:error_can_not_remove_role)
+ flash[:error] = I18n.t(:error_can_not_remove_role)
redirect_to action: 'index'
end
@@ -102,7 +102,7 @@ class RolesController < ApplicationController
calls = bulk_update_roles(@roles)
if calls.all?(&:success?)
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_to action: 'index'
else
@calls = calls
diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb
index 0b95a8e0ec6..0eeaa660b3d 100644
--- a/app/controllers/settings_controller.rb
+++ b/app/controllers/settings_controller.rb
@@ -52,7 +52,7 @@ class SettingsController < ApplicationController
@plugin = Redmine::Plugin.find(params[:id])
if request.post?
Setting["plugin_#{@plugin.id}"] = params[:settings].permit!.to_h
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_to action: 'plugin', id: @plugin.id
else
@partial = @plugin.settings[:partial]
diff --git a/app/controllers/statuses_controller.rb b/app/controllers/statuses_controller.rb
index dd5d1bad5c4..4e9991b12be 100644
--- a/app/controllers/statuses_controller.rb
+++ b/app/controllers/statuses_controller.rb
@@ -48,7 +48,7 @@ class StatusesController < ApplicationController
def create
@status = Status.new(permitted_params.status)
if @status.save
- flash[:notice] = l(:notice_successful_create)
+ flash[:notice] = I18n.t(:notice_successful_create)
redirect_to action: 'index'
else
render action: 'new'
@@ -62,7 +62,7 @@ class StatusesController < ApplicationController
def update
@status = Status.find(params[:id])
if @status.update(permitted_params.status)
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_to action: 'index'
else
render action: 'edit'
@@ -72,22 +72,22 @@ class StatusesController < ApplicationController
def destroy
status = Status.find(params[:id])
if status.is_default?
- flash[:error] = l(:error_unable_delete_default_status)
+ flash[:error] = I18n.t(:error_unable_delete_default_status)
else
status.destroy
- flash[:notice] = l(:notice_successful_delete)
+ flash[:notice] = I18n.t(:notice_successful_delete)
end
redirect_to action: 'index'
rescue
- flash[:error] = l(:error_unable_delete_status)
+ flash[:error] = I18n.t(:error_unable_delete_status)
redirect_to action: 'index'
end
def update_work_package_done_ratio
if Status.update_work_package_done_ratios
- flash[:notice] = l(:notice_work_package_done_ratios_updated)
+ flash[:notice] = I18n.t(:notice_work_package_done_ratios_updated)
else
- flash[:error] = l(:error_work_package_done_ratios_not_updated)
+ flash[:error] = I18n.t(:error_work_package_done_ratios_not_updated)
end
redirect_to action: 'index'
end
diff --git a/app/controllers/types_controller.rb b/app/controllers/types_controller.rb
index b1d20e61496..78d2e645087 100644
--- a/app/controllers/types_controller.rb
+++ b/app/controllers/types_controller.rb
@@ -103,7 +103,7 @@ class TypesController < ApplicationController
@type = ::Type.find(params[:id])
if @type.update(permitted_params.type_move)
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
else
flash.now[:error] = t('type_could_not_be_saved')
render action: 'edit'
@@ -118,7 +118,7 @@ class TypesController < ApplicationController
# put that into the model and do a `if @type.destroy`
if @type.work_packages.empty? && [email protected]_standard?
@type.destroy
- flash[:notice] = l(:notice_successful_delete)
+ flash[:notice] = I18n.t(:notice_successful_delete)
else
flash[:error] = if @type.is_standard?
t(:error_can_not_delete_standard_type)
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 494707fc59c..fe35ebdfcfb 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -107,7 +107,7 @@ class UsersController < ApplicationController
if UserInvitation.invite_user! @user
respond_to do |format|
format.html do
- flash[:notice] = l(:notice_successful_create)
+ flash[:notice] = I18n.t(:notice_successful_create)
redirect_to(params[:continue] ? new_user_path : edit_user_path(@user))
end
end
@@ -175,7 +175,7 @@ class UsersController < ApplicationController
respond_to do |format|
format.html do
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_back(fallback_location: edit_user_path(@user))
end
end
@@ -263,7 +263,7 @@ class UsersController < ApplicationController
Users::DeleteService.new(@user, User.current).call
- flash[:notice] = l('account.deleted')
+ flash[:notice] = I18n.t('account.deleted')
respond_to do |format|
format.html do
diff --git a/app/controllers/users_settings_controller.rb b/app/controllers/users_settings_controller.rb
index e20c72cf492..3160a7c7fab 100644
--- a/app/controllers/users_settings_controller.rb
+++ b/app/controllers/users_settings_controller.rb
@@ -42,7 +42,7 @@ class UsersSettingsController < ::ApplicationController
.new(user: current_user)
.call(settings: permitted_params.settings.to_h)
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_to action: 'index'
end
end
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb
index 789a1fffec1..18c786cc01f 100644
--- a/app/controllers/wiki_controller.rb
+++ b/app/controllers/wiki_controller.rb
@@ -113,7 +113,7 @@ class WikiController < ApplicationController
if @page.save
call_hook(:controller_wiki_edit_after_save, params: params, page: @page)
- flash[:notice] = l(:notice_successful_create)
+ flash[:notice] = I18n.t(:notice_successful_create)
redirect_to_show
else
render action: 'new'
@@ -178,14 +178,14 @@ class WikiController < ApplicationController
if @page.save_with_content
call_hook(:controller_wiki_edit_after_save, params: params, page: @page)
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_to_show
else
render action: 'edit'
end
rescue ActiveRecord::StaleObjectError
# Optimistic locking exception
- flash.now[:error] = l(:notice_locking_conflict)
+ flash.now[:error] = I18n.t(:notice_locking_conflict)
render action: 'edit'
end
@@ -242,7 +242,7 @@ class WikiController < ApplicationController
@page.parent_id = params[:wiki_page][:parent_id]
if @page.save
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_to_show
else
@parent_pages = @wiki.pages.includes(:parent) - @page.self_and_descendants
@@ -289,7 +289,7 @@ class WikiController < ApplicationController
# Children can be either set as root pages, removed or reassigned to another parent page
def destroy
unless editable?
- flash[:error] = l(:error_unable_delete_wiki)
+ flash[:error] = I18n.t(:error_unable_delete_wiki)
return render_403
end
@@ -316,10 +316,10 @@ class WikiController < ApplicationController
@page.destroy
if page = @wiki.find_page(@wiki.start_page) || @wiki.pages.first
- flash[:notice] = l(:notice_successful_delete)
+ flash[:notice] = I18n.t(:notice_successful_delete)
redirect_to action: 'index', project_id: @project, id: page
else
- flash[:notice] = l(:notice_successful_delete)
+ flash[:notice] = I18n.t(:notice_successful_delete)
redirect_to project_path(@project)
end
end
@@ -353,7 +353,7 @@ class WikiController < ApplicationController
def locked?
return false if editable?
- flash[:error] = l(:error_unable_update_wiki)
+ flash[:error] = I18n.t(:error_unable_update_wiki)
render_403
true
end
diff --git a/app/controllers/work_packages/bulk_controller.rb b/app/controllers/work_packages/bulk_controller.rb
index 098e514317c..7264348ae35 100644
--- a/app/controllers/work_packages/bulk_controller.rb
+++ b/app/controllers/work_packages/bulk_controller.rb
@@ -113,6 +113,6 @@ class WorkPackages::BulkController < ApplicationController
end
def default_breadcrumb
- l(:label_work_package_plural)
+ I18n.t(:label_work_package_plural)
end
end
diff --git a/app/controllers/work_packages/moves_controller.rb b/app/controllers/work_packages/moves_controller.rb
index 6cd9b51ad58..337a76de42e 100644
--- a/app/controllers/work_packages/moves_controller.rb
+++ b/app/controllers/work_packages/moves_controller.rb
@@ -86,12 +86,12 @@ class WorkPackages::MovesController < ApplicationController
def set_flash_from_bulk_work_package_save(work_packages, unsaved_work_package_ids)
if unsaved_work_package_ids.empty? and not work_packages.empty?
- flash[:notice] = @copy ? l(:notice_successful_create) : l(:notice_successful_update)
+ flash[:notice] = @copy ? I18n.t(:notice_successful_create) : I18n.t(:notice_successful_update)
else
- flash[:error] = l(:notice_failed_to_save_work_packages,
- count: unsaved_work_package_ids.size,
- total: work_packages.size,
- ids: '#' + unsaved_work_package_ids.join(', #'))
+ flash[:error] = I18n.t(:notice_failed_to_save_work_packages,
+ count: unsaved_work_package_ids.size,
+ total: work_packages.size,
+ ids: '#' + unsaved_work_package_ids.join(', #'))
end
end
@@ -112,7 +112,7 @@ class WorkPackages::MovesController < ApplicationController
end
def default_breadcrumb
- l(:label_move_work_package)
+ I18n.t(:label_move_work_package)
end
private
diff --git a/app/controllers/work_packages/reports_controller.rb b/app/controllers/work_packages/reports_controller.rb
index 35f453bcdfb..88ce4d423f5 100644
--- a/app/controllers/work_packages/reports_controller.rb
+++ b/app/controllers/work_packages/reports_controller.rb
@@ -64,6 +64,6 @@ class WorkPackages::ReportsController < ApplicationController
private
def default_breadcrumb
- l(:label_summary)
+ I18n.t(:label_summary)
end
end
diff --git a/app/controllers/work_packages/settings_controller.rb b/app/controllers/work_packages/settings_controller.rb
index 4438ad35c7d..07282151fa4 100644
--- a/app/controllers/work_packages/settings_controller.rb
+++ b/app/controllers/work_packages/settings_controller.rb
@@ -44,7 +44,7 @@ class WorkPackages::SettingsController < ::ApplicationController
.new(user: current_user)
.call(settings: permitted_params.settings.to_h)
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_to action: 'index'
end
end
diff --git a/app/controllers/work_packages_controller.rb b/app/controllers/work_packages_controller.rb
index c68548f1096..e7552f8abe0 100644
--- a/app/controllers/work_packages_controller.rb
+++ b/app/controllers/work_packages_controller.rb
@@ -112,7 +112,7 @@ class WorkPackagesController < ApplicationController
def atom_list
render_feed(@work_packages,
- title: "#{@project || Setting.app_title}: #{l(:label_work_package_plural)}")
+ title: "#{@project || Setting.app_title}: #{I18n.t(:label_work_package_plural)}")
end
private
diff --git a/app/controllers/workflows_controller.rb b/app/controllers/workflows_controller.rb
index 5feaa440ea0..a34beceaa42 100644
--- a/app/controllers/workflows_controller.rb
+++ b/app/controllers/workflows_controller.rb
@@ -83,12 +83,12 @@ class WorkflowsController < ApplicationController
if request.post?
if params[:source_type_id].blank? || params[:source_role_id].blank? || (@source_type.nil? && @source_role.nil?)
- flash.now[:error] = l(:error_workflow_copy_source)
+ flash.now[:error] = I18n.t(:error_workflow_copy_source)
elsif @target_types.nil? || @target_roles.nil?
- flash.now[:error] = l(:error_workflow_copy_target)
+ flash.now[:error] = I18n.t(:error_workflow_copy_target)
else
Workflow.copy(@source_type, @source_role, @target_types, @target_roles)
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_to action: 'copy', source_type_id: @source_type, source_role_id: @source_role
end
end
diff --git a/app/helpers/accessibility_helper.rb b/app/helpers/accessibility_helper.rb
index 04d43a0766d..5f64a481efc 100644
--- a/app/helpers/accessibility_helper.rb
+++ b/app/helpers/accessibility_helper.rb
@@ -30,9 +30,9 @@
module AccessibilityHelper
def you_are_here_info(condition = true, disabled = nil)
if condition && !disabled
- "<span style = 'display: block' class = 'position-label hidden-for-sighted'>#{l(:description_current_position)}</span>".html_safe
+ "<span style = 'display: block' class = 'position-label hidden-for-sighted'>#{I18n.t(:description_current_position)}</span>".html_safe
elsif condition && disabled
- "<span style = 'display: none' class = 'position-label hidden-for-sighted'>#{l(:description_current_position)}</span>".html_safe
+ "<span style = 'display: none' class = 'position-label hidden-for-sighted'>#{I18n.t(:description_current_position)}</span>".html_safe
else
''
end
diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb
index a0ab7c3d869..d8695b27105 100644
--- a/app/helpers/admin_helper.rb
+++ b/app/helpers/admin_helper.rb
@@ -29,7 +29,7 @@
module AdminHelper
def project_status_options_for_select(selected)
- options_for_select([[l(:label_all), ''],
- [l(:status_active), 1]], selected)
+ options_for_select([[I18n.t(:label_all), ''],
+ [I18n.t(:status_active), 1]], selected)
end
end
diff --git a/app/helpers/announcements_helper.rb b/app/helpers/announcements_helper.rb
index 9f907065cc9..ef727a2ddba 100644
--- a/app/helpers/announcements_helper.rb
+++ b/app/helpers/announcements_helper.rb
@@ -1,9 +1,9 @@
module AnnouncementsHelper
def notice_annoucement_active
if @announcement.active_and_current?
- l(:'announcements.is_active')
+ I18n.t(:'announcements.is_active')
else
- l(:'announcements.is_inactive')
+ I18n.t(:'announcements.is_inactive')
end
end
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 5e57e9e5973..5550c69e4ba 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -108,7 +108,7 @@ module ApplicationHelper
end
def format_activity_day(date)
- date == User.current.today ? l(:label_today).titleize : format_date(date)
+ date == User.current.today ? I18n.t(:label_today).titleize : format_date(date)
end
def format_activity_description(text)
@@ -120,7 +120,7 @@ module ApplicationHelper
def due_date_distance_in_words(date)
if date
label = date < Date.today ? :label_roadmap_overdue : :label_roadmap_due_in
- l(label, distance_of_date_in_words(Date.today, date))
+ I18n.t(label, value: distance_of_date_in_words(Date.today, date))
end
end
@@ -249,11 +249,16 @@ module ApplicationHelper
def authoring(created, author, options = {})
label = options[:label] || :label_added_time_by
- l(label, author: link_to_user(author), age: time_tag(created)).html_safe
+ I18n.t(label, author: link_to_user(author), age: time_tag(created)).html_safe
end
def authoring_at(created, author)
- l(:'js.label_added_time_by', author: author.name, age: created, authorLink: user_path(author)).html_safe unless author.nil?
+ return unless author.nil?
+
+ I18n.t(:'js.label_added_time_by',
+ author: author.name,
+ age: created,
+ authorLink: user_path(author)).html_safe
end
def time_tag(time)
@@ -286,7 +291,7 @@ module ApplicationHelper
formats = capture(Redmine::Views::OtherFormatsBuilder.new(self), &block)
unless formats.nil? || formats.strip.empty?
content_tag 'p', class: 'other-formats' do
- (l(:label_export_to) + formats).html_safe
+ (I18n.t(:label_export_to) + formats).html_safe
end
end
end
diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb
index 2969d57b976..221dff87e12 100644
--- a/app/helpers/custom_fields_helper.rb
+++ b/app/helpers/custom_fields_helper.rb
@@ -101,7 +101,7 @@ module CustomFieldsHelper
hidden_tag + checkbox_tag
when 'list'
blank_option = if custom_field.is_required? && custom_field.default_value.blank?
- "<option value=\"\">--- #{l(:actionview_instancetag_blank_option)} ---</option>"
+ "<option value=\"\">--- #{I18n.t(:actionview_instancetag_blank_option)} ---</option>"
elsif custom_field.is_required? && !custom_field.default_value.blank?
''
else
@@ -161,11 +161,11 @@ module CustomFieldsHelper
when 'text'
styled_text_area_tag(field_name, '', id: field_id, rows: 3, with_text_formatting: true)
when 'bool'
- styled_select_tag(field_name, options_for_select([[l(:label_no_change_option), ''],
- [l(:general_text_yes), '1'],
- [l(:general_text_no), '0']]), id: field_id)
+ styled_select_tag(field_name, options_for_select([[I18n.t(:label_no_change_option), ''],
+ [I18n.t(:general_text_yes), '1'],
+ [I18n.t(:general_text_no), '0']]), id: field_id)
when 'list'
- styled_select_tag(field_name, options_for_select([[l(:label_no_change_option), '']] + custom_field.possible_values_options(project)), id: field_id)
+ styled_select_tag(field_name, options_for_select([[I18n.t(:label_no_change_option), '']] + custom_field.possible_values_options(project)), id: field_id)
else
styled_text_field_tag(field_name, '', id: field_id)
end
@@ -174,6 +174,7 @@ module CustomFieldsHelper
# Return a string used to display a custom value
def show_value(custom_value)
return '' unless custom_value
+
custom_value.formatted_value
end
diff --git a/app/helpers/errors_helper.rb b/app/helpers/errors_helper.rb
index 293592cb0fc..a2d33b7104d 100644
--- a/app/helpers/errors_helper.rb
+++ b/app/helpers/errors_helper.rb
@@ -92,7 +92,7 @@ module ErrorsHelper
op_handle_error(arg[:exception] || "[Error #@status] #@message", payload: arg[:payload])
end
- @message = l(@message) if @message.is_a?(Symbol)
+ @message = I18n.t(@message) if @message.is_a?(Symbol)
@message_details = arg[:message_details]
respond_to do |format|
format.html do
diff --git a/app/helpers/relations_helper.rb b/app/helpers/relations_helper.rb
index f457586240a..cac5d043381 100644
--- a/app/helpers/relations_helper.rb
+++ b/app/helpers/relations_helper.rb
@@ -30,6 +30,6 @@
module RelationsHelper
def collection_for_relation_type_select
values = Relation::TYPES
- values.keys.sort { |x, y| values[x][:order] <=> values[y][:order] }.map { |k| [l(values[k][:name]), k] }
+ values.keys.sort { |x, y| values[x][:order] <=> values[y][:order] }.map { |k| [I18n.t(values[k][:name]), k] }
end
end
diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb
index c8a82ad141a..06323a9e427 100644
--- a/app/helpers/repositories_helper.rb
+++ b/app/helpers/repositories_helper.rb
@@ -132,7 +132,7 @@ module RepositoriesHelper
show_revisions_path_project_repository_path(project_id: @project,
repo_path: path_param,
rev: @changeset.identifier),
- title: l(:label_folder))
+ title: I18n.t(:label_folder))
output << "<li class='#{style} icon icon-folder-#{calculate_folder_action(s)}'>#{text}</li>"
output << render_changes_tree(s)
@@ -153,7 +153,7 @@ module RepositoriesHelper
text << raw(" - #{h(c.revision)}") unless c.revision.blank?
if c.action == 'M'
- text << raw(' (' + link_to(l(:label_diff),
+ text << raw(' (' + link_to(I18n.t(:label_diff),
diff_revision_project_repository_path(project_id: @project,
repo_path: path_param,
rev: @changeset.identifier)) + ') ')
@@ -238,7 +238,7 @@ module RepositoriesHelper
def default_selected_option
[
- "--- #{l(:actionview_instancetag_blank_option)} ---",
+ "--- #{I18n.t(:actionview_instancetag_blank_option)} ---",
'',
{ disabled: true, selected: true }
]
@@ -282,15 +282,15 @@ module RepositoriesHelper
def changes_tree_change_title(action)
case action
when 'A'
- l(:label_added)
+ I18n.t(:label_added)
when 'D'
- l(:label_deleted)
+ I18n.t(:label_deleted)
when 'C'
- l(:label_copied)
+ I18n.t(:label_copied)
when 'R'
- l(:label_renamed)
+ I18n.t(:label_renamed)
else
- l(:label_modified)
+ I18n.t(:label_modified)
end
end
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
index 78536ec4bcc..ffb1eb975ca 100644
--- a/app/helpers/search_helper.rb
+++ b/app/helpers/search_helper.rb
@@ -105,7 +105,7 @@ module SearchHelper
end
def link_to_previous_search_page(pagination_previous_date)
- link_to_content_update(l(:label_previous),
+ link_to_content_update(I18n.t(:label_previous),
@search_params.merge(previous: 1,
project_id: @project.try(:identifier),
offset: pagination_previous_date.to_r.to_s),
@@ -113,7 +113,7 @@ module SearchHelper
end
def link_to_next_search_page(pagination_next_date)
- link_to_content_update(l(:label_next),
+ link_to_content_update(I18n.t(:label_next),
@search_params.merge(previous: nil,
project_id: @project.try(:identifier),
offset: pagination_next_date.to_r.to_s),
diff --git a/app/helpers/tabs_helper.rb b/app/helpers/tabs_helper.rb
index 3b9018fe347..39f368284ae 100644
--- a/app/helpers/tabs_helper.rb
+++ b/app/helpers/tabs_helper.rb
@@ -34,7 +34,7 @@ module TabsHelper
selected_tab = tabs.detect { |t| t[:name] == params[:tab] } if params[:tab].present?
render partial: 'common/tabs', locals: { f: form, tabs: tabs, selected_tab: selected_tab || tabs.first }
else
- content_tag 'p', l(:label_no_data), class: 'nodata'
+ content_tag 'p', I18n.t(:label_no_data), class: 'nodata'
end
end
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
index 0a2f49c4318..9fe8025cad3 100644
--- a/app/helpers/users_helper.rb
+++ b/app/helpers/users_helper.rb
@@ -131,10 +131,10 @@ module UsersHelper
# Disables projects the user is already member in
def options_for_membership_project_select(user, projects)
options = project_tree_options_for_select(projects, disabled: user.projects.ids.to_set)
- content_tag('option', "--- #{l(:actionview_instancetag_blank_option)} ---") + options
+ content_tag('option', "--- #{I18n.t(:actionview_instancetag_blank_option)} ---") + options
end
def user_mail_notification_options(user)
- user.valid_notification_options.map { |o| [l(o.last), o.first] }
+ user.valid_notification_options.map { |o| [I18n.t(o.last), o.first] }
end
end
diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb
index 5df16a5ea4e..f8fdc7712ec 100644
--- a/app/helpers/watchers_helper.rb
+++ b/app/helpers/watchers_helper.rb
@@ -35,7 +35,7 @@ module WatchersHelper
options = options.with_indifferent_access
raise ArgumentError, 'Missing :replace option in options hash' if options['replace'].blank?
- return '' unless user && user.logged? && object.respond_to?('watched_by?')
+ return '' unless user&.logged? && object.respond_to?('watched_by?')
watched = object.watched_by?(user)
@@ -45,18 +45,11 @@ module WatchersHelper
replace: options.delete('replace'))
html_options[:class] = html_options[:class].to_s + ' button'
- method = watched ?
- :delete :
- :post
+ method = watched ? :delete : :post
- label = watched ?
- l(:button_unwatch) :
- l(:button_watch)
+ label = watched ? I18n.t(:button_unwatch) : I18n.t(:button_watch)
link_to(content_tag(:i,'', class: watched ? 'button--icon icon-watched' : ' button--icon icon-unwatched') + ' ' +
content_tag(:span, label, class: 'button--text'), path, html_options.merge(method: method))
-
-
-
end
end
diff --git a/app/helpers/work_packages_helper.rb b/app/helpers/work_packages_helper.rb
index ecf8f8bbf31..b4e70bc8b1e 100644
--- a/app/helpers/work_packages_helper.rb
+++ b/app/helpers/work_packages_helper.rb
@@ -172,7 +172,7 @@ module WorkPackagesHelper
checked,
class: 'form--check-box')
boxes
- end) + l(:label_notify_member_plural)
+ end) + I18n.t(:label_notify_member_plural)
end
end
@@ -194,7 +194,7 @@ module WorkPackagesHelper
def work_package_associations_to_address(associated)
ret = ''.html_safe
- ret += content_tag(:p, l(:text_destroy_with_associated), class: 'bold')
+ ret += content_tag(:p, I18n.t(:text_destroy_with_associated), class: 'bold')
ret += content_tag(:ul) {
associated.inject(''.html_safe) do |list, associated_class|
diff --git a/app/models/activities/changeset_activity_provider.rb b/app/models/activities/changeset_activity_provider.rb
index 57471847c05..452aa451ff8 100644
--- a/app/models/activities/changeset_activity_provider.rb
+++ b/app/models/activities/changeset_activity_provider.rb
@@ -76,7 +76,7 @@ class Activities::ChangesetActivityProvider < Activities::BaseActivityProvider
short_comment = split_comment(event['comments']).first
- title = "#{l(:label_revision)} #{revision}"
+ title = "#{I18n.t(:label_revision)} #{revision}"
title << (short_comment.blank? ? '' : (': ' + short_comment))
end
diff --git a/app/models/activities/wiki_content_activity_provider.rb b/app/models/activities/wiki_content_activity_provider.rb
index 79c3f4d017a..01f51877372 100644
--- a/app/models/activities/wiki_content_activity_provider.rb
+++ b/app/models/activities/wiki_content_activity_provider.rb
@@ -51,7 +51,7 @@ class Activities::WikiContentActivityProvider < Activities::BaseActivityProvider
protected
def event_title(event)
- "#{l(:label_wiki_edit)}: #{event['wiki_title']} (##{event['version']})"
+ "#{I18n.t(:label_wiki_edit)}: #{event['wiki_title']} (##{event['version']})"
end
def event_type(_event)
diff --git a/app/models/category.rb b/app/models/category.rb
index fb631b3f26c..0fac248c9e1 100644
--- a/app/models/category.rb
+++ b/app/models/category.rb
@@ -39,7 +39,7 @@ class Category < ApplicationRecord
# validates that assignee is member of the issue category's project
validates_each :assigned_to_id do |record, attr, value|
if value # allow nil
- record.errors.add(attr, l(:error_must_be_project_member)) unless record.project.principals.map(&:id).include? value
+ record.errors.add(attr, I18n.t(:error_must_be_project_member)) unless record.project.principals.map(&:id).include? value
end
end
diff --git a/app/models/changeset.rb b/app/models/changeset.rb
index 324701732d4..84f463e0fec 100644
--- a/app/models/changeset.rb
+++ b/app/models/changeset.rb
@@ -35,10 +35,19 @@ class Changeset < ApplicationRecord
acts_as_journalized
- acts_as_event title: Proc.new { |o| "#{l(:label_revision)} #{o.format_identifier}" + (o.short_comments.blank? ? '' : (': ' + o.short_comments)) },
+ acts_as_event title: Proc.new { |o|
+ "#{I18n.t(:label_revision)} #{o.format_identifier}" + (o.short_comments.blank? ? '' : (': ' + o.short_comments))
+ },
description: :long_comments,
datetime: :committed_on,
- url: Proc.new { |o| { controller: '/repositories', action: 'revision', project_id: o.repository.project_id, rev: o.identifier } },
+ url: Proc.new { |o|
+ {
+ controller: '/repositories',
+ action: 'revision',
+ project_id: o.repository.project_id,
+ rev: o.identifier
+ }
+ },
author: Proc.new { |o| o.author }
acts_as_searchable columns: 'comments',
diff --git a/app/models/wiki_content.rb b/app/models/wiki_content.rb
index ebeec3498e6..893f2af963e 100644
--- a/app/models/wiki_content.rb
+++ b/app/models/wiki_content.rb
@@ -43,8 +43,18 @@ class WikiContent < ApplicationRecord
acts_as_journalized
acts_as_event type: 'wiki-page',
- title: Proc.new { |o| "#{l(:label_wiki_edit)}: #{o.journal.journable.page.title} (##{o.journal.journable.version})" },
- url: Proc.new { |o| { controller: '/wiki', action: 'show', id: o.journal.journable.page, project_id: o.journal.journable.page.wiki.project, version: o.journal.journable.version } }
+ title: Proc.new { |o|
+ "#{I18n.t(:label_wiki_edit)}: #{o.journal.journable.page.title} (##{o.journal.journable.version})"
+ },
+ url: Proc.new { |o|
+ {
+ controller: '/wiki',
+ action: 'show',
+ id: o.journal.journable.page,
+ project_id: o.journal.journable.page.wiki.project,
+ version: o.journal.journable.version
+ }
+ }
def activity_type
'wiki_edits'
diff --git a/app/models/work_package/exporter/csv.rb b/app/models/work_package/exporter/csv.rb
index 9d5566c6e95..7656b4611fa 100644
--- a/app/models/work_package/exporter/csv.rb
+++ b/app/models/work_package/exporter/csv.rb
@@ -35,7 +35,7 @@ class WorkPackage::Exporter::CSV < WorkPackage::Exporter::Base
include ActionView::Helpers::NumberHelper
def list
- serialized = CSV.generate(col_sep: l(:general_csv_separator)) do |csv|
+ serialized = CSV.generate(col_sep: I18n.t(:general_csv_separator)) do |csv|
headers = csv_headers
csv << self.class.encode_csv_columns(headers)
@@ -48,7 +48,7 @@ class WorkPackage::Exporter::CSV < WorkPackage::Exporter::Base
yield success(serialized)
end
- def self.encode_csv_columns(columns, encoding = l(:general_csv_encoding))
+ def self.encode_csv_columns(columns, encoding = I18n.t(:general_csv_encoding))
columns.map do |cell|
Redmine::CodesetUtil.from_utf8(cell.to_s, encoding)
end
@@ -65,7 +65,7 @@ class WorkPackage::Exporter::CSV < WorkPackage::Exporter::Base
end
def title
- title = query.new_record? ? l(:label_work_package_plural) : query.name
+ title = query.new_record? ? I18n.t(:label_work_package_plural) : query.name
"#{title}.csv"
end
diff --git a/app/services/reports/subproject_report.rb b/app/services/reports/subproject_report.rb
index 69e4e747060..d87583d0fe4 100644
--- a/app/services/reports/subproject_report.rb
+++ b/app/services/reports/subproject_report.rb
@@ -45,6 +45,6 @@ class Reports::SubprojectReport < Reports::Report
end
def title
- l(:label_subproject_plural)
+ I18n.t(:label_subproject_plural)
end
end
diff --git a/app/views/admin/info.html.erb b/app/views/admin/info.html.erb
index 87bcf45a306..aeb3ff72819 100644
--- a/app/views/admin/info.html.erb
+++ b/app/views/admin/info.html.erb
@@ -79,7 +79,7 @@ See docs/COPYRIGHT.rdoc for more details.
<div class="attributes-group">
<div class="attributes-key-value">
<% @checklist.each do |label, result| %>
- <div class="attributes-key-value--key"><%= l(label) %></div>
+ <div class="attributes-key-value--key"><%= I18n.t(label) %></div>
<div class="attributes-key-value--value-container">
<div class="attributes-key-value--value -text">
<span><%= icon_wrapper((result ? 'icon-context icon-checkmark' : 'icon-context icon-bug'), (result ? t(:general_text_Yes) : t(:general_text_No))) %></span>
diff --git a/app/views/custom_fields/edit.html.erb b/app/views/custom_fields/edit.html.erb
index 04848a0d1de..3e56a6785e4 100644
--- a/app/views/custom_fields/edit.html.erb
+++ b/app/views/custom_fields/edit.html.erb
@@ -31,7 +31,7 @@ See docs/COPYRIGHT.rdoc for more details.
<% html_title t(:label_administration), "#{t(:label_edit)} #{CustomField.model_name.human} #{h @custom_field.name}" %>
-<% local_assigns[:additional_breadcrumb] = link_to(l(@custom_field.type_name), custom_fields_path(tab: @custom_field.type)),
+<% local_assigns[:additional_breadcrumb] = link_to(I18n.t(@custom_field.type_name), custom_fields_path(tab: @custom_field.type)),
@custom_field.name %>
<%= breadcrumb_toolbar @custom_field.name %>
diff --git a/app/views/custom_fields/new.html.erb b/app/views/custom_fields/new.html.erb
index b527b311874..6308123bb1e 100644
--- a/app/views/custom_fields/new.html.erb
+++ b/app/views/custom_fields/new.html.erb
@@ -29,7 +29,7 @@ See docs/COPYRIGHT.rdoc for more details.
<%= render :partial => 'custom_fields_header' %>
<% html_title t(:label_administration), t(:label_custom_field_new) %>
-<% local_assigns[:additional_breadcrumb] = link_to(l(@custom_field.type_name), custom_fields_path(tab: @custom_field.type)),
+<% local_assigns[:additional_breadcrumb] = link_to(I18n.t(@custom_field.type_name), custom_fields_path(tab: @custom_field.type)),
t(:label_custom_field_new) %>
<%= breadcrumb_toolbar t(:label_custom_field_new) %>
<%= error_messages_for 'custom_field' %>
diff --git a/app/views/custom_styles/show.html.erb b/app/views/custom_styles/show.html.erb
index 7bc25dcd0bd..c2ba028699a 100644
--- a/app/views/custom_styles/show.html.erb
+++ b/app/views/custom_styles/show.html.erb
@@ -80,7 +80,7 @@ See docs/COPYRIGHT.rdoc for more details.
</div>
</div>
- <%= styled_button_tag l(@custom_style.logo.present? ? :button_replace : :button_upload),
+ <%= styled_button_tag I18n.t(@custom_style.logo.present? ? :button_replace : :button_upload),
class: "button #{@custom_style.logo.blank? ? '-with-icon icon-add' : ''}" %>
</fieldset>
diff --git a/app/views/projects/form/_required_storage.html.erb b/app/views/projects/form/_required_storage.html.erb
index 8362ae58fef..1ee3ffffc12 100644
--- a/app/views/projects/form/_required_storage.html.erb
+++ b/app/views/projects/form/_required_storage.html.erb
@@ -33,7 +33,7 @@ See docs/COPYRIGHT.rdoc for more details.
<% storage['modules'].each do |label, value| %>
<%= render partial: 'projects/form/attributes/storage_field',
- locals: { label: l(label), value: value } %>
+ locals: { label: I18n.t(label), value: value } %>
<% end %>
<%# Hide total when there's only one module %>
<% if storage['modules'].length > 1 %>
diff --git a/app/views/user_mailer/_errors.text.erb b/app/views/user_mailer/_errors.text.erb
index 61cc2d00a9b..6cbdcf2bd98 100644
--- a/app/views/user_mailer/_errors.text.erb
+++ b/app/views/user_mailer/_errors.text.erb
@@ -27,7 +27,7 @@ See docs/COPYRIGHT.rdoc for more details.
++#%>
-<%= l('copy_project.errors') %>
+<%= I18n.t('copy_project.errors') %>
<% errors.each do |error| %>
- <%= error %>
diff --git a/app/views/user_mailer/account_information.text.erb b/app/views/user_mailer/account_information.text.erb
index f578ea07ff7..6fd05637dad 100644
--- a/app/views/user_mailer/account_information.text.erb
+++ b/app/views/user_mailer/account_information.text.erb
@@ -33,4 +33,4 @@ See docs/COPYRIGHT.rdoc for more details.
* <%= User.human_attribute_name(:login) %>: <%= @user.login %>
* <%= User.human_attribute_name(:password) %>: <%= @password %>
<% end %>
-<%= l(:label_login) %>: <%= signin_url %>
+<%= I18n.t(:label_login) %>: <%= signin_url %>
diff --git a/config/initializers/register_renderer.rb b/config/initializers/register_renderer.rb
index 03b401fd9df..8fac93a2433 100644
--- a/config/initializers/register_renderer.rb
+++ b/config/initializers/register_renderer.rb
@@ -31,7 +31,7 @@
ActionController::Renderers.add :csv do |obj, options|
filename = options[:filename] || 'data'
str = obj.respond_to?(:to_csv) ? obj.to_csv : obj.to_s
- charset = "charset=#{l(:general_csv_encoding).downcase}"
+ charset = "charset=#{I18n.t(:general_csv_encoding).downcase}"
data = send_data str,
type: "#{Mime[:csv]}; header=present; #{charset};",
diff --git a/lib/open_project/journal_formatter/diff.rb b/lib/open_project/journal_formatter/diff.rb
index f150660045c..278f817d529 100644
--- a/lib/open_project/journal_formatter/diff.rb
+++ b/lib/open_project/journal_formatter/diff.rb
@@ -78,7 +78,7 @@ class OpenProject::JournalFormatter::Diff < JournalFormatter::Base
if options[:no_html]
url_for url_attr
else
- link_to(l(:label_details),
+ link_to(I18n.t(:label_details),
url_attr,
class: 'description-details')
end
diff --git a/lib/open_project/object_linking.rb b/lib/open_project/object_linking.rb
index 42a9bf588e3..fb09b6ceb05 100644
--- a/lib/open_project/object_linking.rb
+++ b/lib/open_project/object_linking.rb
@@ -79,7 +79,7 @@ module OpenProject
text = options.delete(:text) || format_revision(revision)
rev = revision.respond_to?(:identifier) ? revision.identifier : revision
url_opts = { controller: '/repositories', action: 'revision', project_id: project, rev: rev }
- html_options = { title: l(:label_revision_id, format_revision(revision)) }.merge(options)
+ html_options = { title: I18n.t(:label_revision_id, value: format_revision(revision)) }.merge(options)
link_to(h(text), url_opts, html_options)
end
diff --git a/lib/redmine/i18n.rb b/lib/redmine/i18n.rb
index 18e3a5e1bb3..197e9365675 100644
--- a/lib/redmine/i18n.rb
+++ b/lib/redmine/i18n.rb
@@ -48,23 +48,6 @@ module Redmine
end
end
- def l(*args)
- case args.size
- when 1
- ::I18n.t(*args)
- when 2
- if args.last.is_a?(Hash)
- ::I18n.t(args.first, **args.last)
- elsif args.last.is_a?(String)
- ::I18n.t(args.first, value: args.last)
- else
- ::I18n.t(args.first, count: args.last)
- end
- else
- raise "Translation string with multiple values: #{args.first}"
- end
- end
-
def l_or_humanize(s, options = {})
k = "#{options[:prefix]}#{s}".to_sym
::I18n.t(k, default: s.to_s.humanize)
diff --git a/lib/redmine/menu_manager/menu_item.rb b/lib/redmine/menu_manager/menu_item.rb
index 04ef90995af..db479df1399 100644
--- a/lib/redmine/menu_manager/menu_item.rb
+++ b/lib/redmine/menu_manager/menu_item.rb
@@ -77,7 +77,7 @@ class Redmine::MenuManager::MenuItem < Redmine::MenuManager::TreeNode
if @caption.nil?
l_or_humanize(name, prefix: 'label_')
else
- @caption.is_a?(Symbol) ? l(@caption) : @caption
+ @caption.is_a?(Symbol) ? I18n.t(@caption) : @caption
end
end
end
diff --git a/lib/redmine/menu_manager/top_menu/help_menu.rb b/lib/redmine/menu_manager/top_menu/help_menu.rb
index 5a04fe33115..a306b956757 100644
--- a/lib/redmine/menu_manager/top_menu/help_menu.rb
+++ b/lib/redmine/menu_manager/top_menu/help_menu.rb
@@ -45,7 +45,7 @@ module Redmine::MenuManager::TopMenu::HelpMenu
def render_help_dropdown
link_to_help_pop_up = link_to '',
- title: l(:label_help),
+ title: I18n.t(:label_help),
class: 'menu-item--help',
aria: { haspopup: 'true' } do
op_icon('icon-help')
@@ -69,9 +69,9 @@ module Redmine::MenuManager::TopMenu::HelpMenu
def render_onboarding(result)
result << content_tag(:li) do
- content_tag(:span, l('top_menu.getting_started'),
+ content_tag(:span, I18n.t('top_menu.getting_started'),
class: 'drop-down--help-headline',
- title: l('top_menu.getting_started'))
+ title: I18n.t('top_menu.getting_started'))
end
result << render_onboarding_menu_item
result << content_tag(:hr, '', class: 'form--separator')
@@ -83,18 +83,18 @@ module Redmine::MenuManager::TopMenu::HelpMenu
def render_help_and_support(result)
result << content_tag(:li) do
- content_tag :span, l('top_menu.help_and_support'),
+ content_tag :span, I18n.t('top_menu.help_and_support'),
class: 'drop-down--help-headline',
- title: l('top_menu.help_and_support')
+ title: I18n.t('top_menu.help_and_support')
end
if EnterpriseToken.show_banners?
result << static_link_item(:upsale, href_suffix: "/?utm_source=unknown&utm_medium=op-instance&utm_campaign=ee-upsale-help-menu")
end
result << static_link_item(:user_guides)
result << content_tag(:li) {
- link_to l('label_videos'),
+ link_to I18n.t('label_videos'),
OpenProject::Configuration.youtube_channel,
- title: l('label_videos'),
+ title: I18n.t('label_videos'),
target: '_blank'
}
result << static_link_item(:shortcuts)
@@ -106,9 +106,9 @@ module Redmine::MenuManager::TopMenu::HelpMenu
def render_additional_resources(result)
result << content_tag(:li) do
content_tag :span,
- l('top_menu.additional_resources'),
+ I18n.t('top_menu.additional_resources'),
class: 'drop-down--help-headline',
- title: l('top_menu.additional_resources')
+ title: I18n.t('top_menu.additional_resources')
end
if OpenProject::Static::Links.has? :impressum
diff --git a/lib/redmine/menu_manager/top_menu_helper.rb b/lib/redmine/menu_manager/top_menu_helper.rb
index b71f645beb7..a8b0148da85 100644
--- a/lib/redmine/menu_manager/top_menu_helper.rb
+++ b/lib/redmine/menu_manager/top_menu_helper.rb
@@ -61,8 +61,8 @@ module Redmine::MenuManager::TopMenuHelper
url = { controller: '/account', action: 'login' }
link = link_to url,
class: 'login',
- title: l(:label_login) do
- concat('<span class="button--dropdown-text hidden-for-mobile">'.concat(l(:label_login)).concat('</span>').html_safe)
+ title: I18n.t(:label_login) do
+ concat('<span class="button--dropdown-text hidden-for-mobile">'.concat(I18n.t(:label_login)).concat('</span>').html_safe)
concat('<i class="button--dropdown-indicator hidden-for-mobile"></i>'.html_safe)
concat('<i class="icon2 icon-user hidden-for-desktop"></i>'.html_safe)
end
@@ -75,8 +75,8 @@ module Redmine::MenuManager::TopMenuHelper
def render_direct_login
link = link_to signin_path,
class: 'login',
- title: l(:label_login) do
- concat('<span class="button--dropdown-text hidden-for-mobile">'.concat(l(:label_login)).concat('</span>').html_safe)
+ title: I18n.t(:label_login) do
+ concat('<span class="button--dropdown-text hidden-for-mobile">'.concat(I18n.t(:label_login)).concat('</span>').html_safe)
concat('<i class="icon2 icon-user hidden-for-desktop"></i>'.html_safe)
end
diff --git a/lib/tabular_form_builder.rb b/lib/tabular_form_builder.rb
index dcd5aa21316..3dadb32191b 100644
--- a/lib/tabular_form_builder.rb
+++ b/lib/tabular_form_builder.rb
@@ -275,13 +275,13 @@ class TabularFormBuilder < ActionView::Helpers::FormBuilder
def get_localized_field(field, label)
if label.is_a?(Symbol)
- l(label)
+ I18n.t(label)
elsif label
label
elsif @object.class.respond_to?(:human_attribute_name)
@object.class.human_attribute_name(field)
else
- l(field)
+ I18n.t(field)
end
end
diff --git a/modules/backlogs/app/controllers/rb_master_backlogs_controller.rb b/modules/backlogs/app/controllers/rb_master_backlogs_controller.rb
index 58b109fbaf4..c86f949019c 100644
--- a/modules/backlogs/app/controllers/rb_master_backlogs_controller.rb
+++ b/modules/backlogs/app/controllers/rb_master_backlogs_controller.rb
@@ -48,6 +48,6 @@ class RbMasterBacklogsController < RbApplicationController
end
def default_breadcrumb
- l(:label_backlogs)
+ I18n.t(:label_backlogs)
end
end
diff --git a/modules/backlogs/app/controllers/rb_taskboards_controller.rb b/modules/backlogs/app/controllers/rb_taskboards_controller.rb
index 5394f7928cd..329c97ff1ea 100644
--- a/modules/backlogs/app/controllers/rb_taskboards_controller.rb
+++ b/modules/backlogs/app/controllers/rb_taskboards_controller.rb
@@ -40,6 +40,6 @@ class RbTaskboardsController < RbApplicationController
end
def default_breadcrumb
- l(:label_backlogs)
+ I18n.t(:label_backlogs)
end
end
diff --git a/modules/backlogs/app/helpers/burndown_charts_helper.rb b/modules/backlogs/app/helpers/burndown_charts_helper.rb
index 7c5139eba41..b4bc81a7aa7 100644
--- a/modules/backlogs/app/helpers/burndown_charts_helper.rb
+++ b/modules/backlogs/app/helpers/burndown_charts_helper.rb
@@ -36,7 +36,7 @@ module BurndownChartsHelper
mvalue = mvalue + 1 if mvalue == 1 || ((max % 25) == 0)
- labels << "[#{(mvalue) * 25}, '<span class=\"axislabel\">#{l('backlogs.points')}</span>']"
+ labels << "[#{(mvalue) * 25}, '<span class=\"axislabel\">#{I18n.t('backlogs.points')}</span>']"
result = labels.join(', ')
@@ -60,7 +60,7 @@ module BurndownChartsHelper
dataset = {}
burndown.series.each do |s|
dataset[s.first] = {
- label: l('backlogs.' + s.first.to_s),
+ label: I18n.t('backlogs.' + s.first.to_s),
data: s.last.enum_for(:each_with_index).map { |val, i| [i + 1, val] }
}
end
@@ -71,7 +71,7 @@ module BurndownChartsHelper
def burndown_series_checkboxes(burndown)
boxes = ''
burndown.series(:all).map { |s| s.first.to_s }.sort.each do |series|
- boxes += "<input class=\"series_enabled\" type=\"checkbox\" id=\"#{series}\" name=\"#{series}\" value=\"#{series}\" checked>#{l('backlogs.' + series.to_s)}<br/>"
+ boxes += "<input class=\"series_enabled\" type=\"checkbox\" id=\"#{series}\" name=\"#{series}\" value=\"#{series}\" checked>#{I18n.t('backlogs.' + series.to_s)}<br/>"
end
boxes.html_safe
end
diff --git a/modules/backlogs/app/helpers/rb_common_helper.rb b/modules/backlogs/app/helpers/rb_common_helper.rb
index 24c2fa82a57..45344364cae 100644
--- a/modules/backlogs/app/helpers/rb_common_helper.rb
+++ b/modules/backlogs/app/helpers/rb_common_helper.rb
@@ -206,7 +206,7 @@ module RbCommonHelper
def show_burndown_link(sprint)
ret = ''
- ret += link_to(l('backlogs.show_burndown_chart'),
+ ret += link_to(I18n.t('backlogs.show_burndown_chart'),
{},
class: 'show_burndown_chart button')
diff --git a/modules/backlogs/app/helpers/rb_master_backlogs_helper.rb b/modules/backlogs/app/helpers/rb_master_backlogs_helper.rb
index bdba67ac963..5d6e30dcd1a 100644
--- a/modules/backlogs/app/helpers/rb_master_backlogs_helper.rb
+++ b/modules/backlogs/app/helpers/rb_master_backlogs_helper.rb
@@ -62,11 +62,11 @@ module RbMasterBacklogsHelper
items = {}
items[:new_story] = content_tag(:a,
- l('backlogs.add_new_story'),
+ I18n.t('backlogs.add_new_story'),
href: '#',
class: 'add_new_story')
- items[:stories_tasks] = link_to(l(:label_stories_tasks),
+ items[:stories_tasks] = link_to(I18n.t(:label_stories_tasks),
controller: '/rb_queries',
action: 'show',
project_id: @project,
@@ -85,7 +85,7 @@ module RbMasterBacklogsHelper
def export_export_cards_link(backlog)
if @export_card_config_meta[:count] == 1
- link_to(l(:label_backlogs_export_card_export),
+ link_to(I18n.t(:label_backlogs_export_card_export),
controller: '/rb_export_card_configurations',
action: 'show',
project_id: @project,
@@ -102,19 +102,19 @@ module RbMasterBacklogsHelper
version_path = edit_version_path(backlog.sprint, back_url: back_path)
- link_to(l(:'backlogs.properties'), version_path)
+ link_to(I18n.t(:'backlogs.properties'), version_path)
end
def export_modal_link(backlog, options = {})
path = backlogs_project_sprint_export_card_configurations_path(@project.id, backlog.sprint.id)
html_id = "modal_work_package_#{SecureRandom.hex(10)}"
- link_to(l(:label_backlogs_export_card_export), path, options.merge(id: html_id, :'data-modal' => ''))
+ link_to(I18n.t(:label_backlogs_export_card_export), path, options.merge(id: html_id, :'data-modal' => ''))
end
def sprint_backlog_menu_items_for(backlog)
items = {}
- items[:task_board] = link_to(l(:label_task_board),
+ items[:task_board] = link_to(I18n.t(:label_task_board),
{ controller: '/rb_taskboards',
action: 'show',
project_id: @project,
@@ -124,13 +124,13 @@ module RbMasterBacklogsHelper
if backlog.sprint.has_burndown?
items[:burndown] = content_tag(:a,
- l('backlogs.show_burndown_chart'),
+ I18n.t('backlogs.show_burndown_chart'),
href: '#',
class: 'show_burndown_chart')
end
if @project.module_enabled? 'wiki'
- items[:wiki] = link_to(l(:label_wiki),
+ items[:wiki] = link_to(I18n.t(:label_wiki),
controller: '/rb_wikis',
action: 'edit',
project_id: @project,
diff --git a/modules/backlogs/app/views/shared/_server_variables.js.erb b/modules/backlogs/app/views/shared/_server_variables.js.erb
index f516779d8e8..f34fe1e98c4 100644
--- a/modules/backlogs/app/views/shared/_server_variables.js.erb
+++ b/modules/backlogs/app/views/shared/_server_variables.js.erb
@@ -38,8 +38,8 @@ RB.constants = {
};
RB.i18n = {
- generating_graph: '<%= j l("backlogs.generating_chart").html_safe %>',
- burndown_graph: '<%= j l("backlogs.burndown_graph").html_safe %>'
+ generating_graph: '<%= j I18n.t("backlogs.generating_chart").html_safe %>',
+ burndown_graph: '<%= j I18n.t("backlogs.burndown_graph").html_safe %>'
};
RB.urlFor = (function () {
diff --git a/modules/backlogs/lib/open_project/backlogs/hooks.rb b/modules/backlogs/lib/open_project/backlogs/hooks.rb
index a988c62fbf6..ec08465ef3f 100644
--- a/modules/backlogs/lib/open_project/backlogs/hooks.rb
+++ b/modules/backlogs/lib/open_project/backlogs/hooks.rb
@@ -40,7 +40,7 @@ module OpenProject::Backlogs::Hooks
if User.current.allowed_to?(:edit_wiki_pages, project)
snippet += '<span id="edit_wiki_page_action">'
- snippet += link_to l(:button_edit_wiki), { controller: '/rb_wikis', action: 'edit', project_id: project.id, sprint_id: version.id }, class: 'icon icon-edit'
+ snippet += link_to I18n.t(:button_edit_wiki), { controller: '/rb_wikis', action: 'edit', project_id: project.id, sprint_id: version.id }, class: 'icon icon-edit'
snippet += '</span>'
# This wouldn't be necesary if the schedules plugin didn't disable the
diff --git a/modules/backlogs/lib/open_project/backlogs/patches/projects_controller_patch.rb b/modules/backlogs/lib/open_project/backlogs/patches/projects_controller_patch.rb
index adfcff2d197..e9a48cc31a6 100644
--- a/modules/backlogs/lib/open_project/backlogs/patches/projects_controller_patch.rb
+++ b/modules/backlogs/lib/open_project/backlogs/patches/projects_controller_patch.rb
@@ -44,18 +44,18 @@ module OpenProject::Backlogs::Patches::ProjectsControllerPatch
@project.done_statuses = selected_statuses
@project.save!
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_to_backlogs_settings
end
def rebuild_positions
@project.rebuild_positions
- flash[:notice] = l('backlogs.positions_rebuilt_successfully')
+ flash[:notice] = I18n.t('backlogs.positions_rebuilt_successfully')
redirect_to_backlogs_settings
rescue ActiveRecord::ActiveRecordError
- flash[:error] = l('backlogs.positions_could_not_be_rebuilt')
+ flash[:error] = I18n.t('backlogs.positions_could_not_be_rebuilt')
logger.error("Tried to rebuild positions for project #{@project.identifier.inspect} but could not...")
logger.error($!)
diff --git a/modules/costs/app/views/hourly_rates/edit.html.erb b/modules/costs/app/views/hourly_rates/edit.html.erb
index 1ad829150a7..0f85a911b1c 100644
--- a/modules/costs/app/views/hourly_rates/edit.html.erb
+++ b/modules/costs/app/views/hourly_rates/edit.html.erb
@@ -27,7 +27,7 @@ See docs/COPYRIGHT.rdoc for more details.
++#%>
-<% html_title t(:label_administration), "#{t(:label_edit)} #{l((@project.nil? ? :caption_default_rate_history_for : :caption_rate_history_for), user: ' ')} #{@user.name}" %>
+<% html_title t(:label_administration), "#{t(:label_edit)} #{I18n.t((@project.nil? ? :caption_default_rate_history_for : :caption_rate_history_for), user: ' ')} #{@user.name}" %>
<%= toolbar title: (@project.nil? ? t(:caption_default_rate_history_for, user: @user.name) : t(:caption_rate_history_for_project, user: @user.name, project: @project.name) ) %>
diff --git a/modules/documents/app/controllers/documents_controller.rb b/modules/documents/app/controllers/documents_controller.rb
index 18d412a7625..eda7c0a68ad 100644
--- a/modules/documents/app/controllers/documents_controller.rb
+++ b/modules/documents/app/controllers/documents_controller.rb
@@ -68,7 +68,7 @@ class DocumentsController < ApplicationController
@document.attach_files(permitted_params.attachments.to_h)
if @document.save
- flash[:notice] = l(:notice_successful_create)
+ flash[:notice] = I18n.t(:notice_successful_create)
redirect_to project_documents_path(@project)
else
render action: 'new'
@@ -84,7 +84,7 @@ class DocumentsController < ApplicationController
@document.attach_files(permitted_params.attachments.to_h)
if @document.save
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_to action: 'show', id: @document
else
render action: 'edit'
diff --git a/modules/global_roles/app/models/principal_role.rb b/modules/global_roles/app/models/principal_role.rb
index b92acde1e77..9f9a6c69157 100644
--- a/modules/global_roles/app/models/principal_role.rb
+++ b/modules/global_roles/app/models/principal_role.rb
@@ -38,6 +38,6 @@ class PrincipalRole < ApplicationRecord
private
def add_error_can_not_be_assigned
- errors[:base] << l(:error_can_not_be_assigned)
+ errors[:base] << I18n.t(:error_can_not_be_assigned)
end
end
diff --git a/modules/meeting/app/controllers/meeting_contents_controller.rb b/modules/meeting/app/controllers/meeting_contents_controller.rb
index 257ae60d88a..cc0ffb1f89f 100644
--- a/modules/meeting/app/controllers/meeting_contents_controller.rb
+++ b/modules/meeting/app/controllers/meeting_contents_controller.rb
@@ -65,12 +65,12 @@ class MeetingContentsController < ApplicationController
@content.author = User.current
@content.attach_files(permitted_params.attachments.to_h)
if @content.save
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_back_or_default controller: '/meetings', action: 'show', id: @meeting
end
rescue ActiveRecord::StaleObjectError
# Optimistic locking exception
- flash.now[:error] = l(:notice_locking_conflict)
+ flash.now[:error] = I18n.t(:notice_locking_conflict)
params[:tab] ||= 'minutes' if @meeting.agenda.present? && @meeting.agenda.locked?
render 'meetings/show'
end
@@ -98,10 +98,10 @@ class MeetingContentsController < ApplicationController
result = service.call(@content, :content_for_review)
if result.success?
- flash[:notice] = l(:notice_successful_notification)
+ flash[:notice] = I18n.t(:notice_successful_notification)
else
- flash[:error] = l(:error_notification_with_errors,
- recipients: result.errors.map(&:name).join('; '))
+ flash[:error] = I18n.t(:error_notification_with_errors,
+ recipients: result.errors.map(&:name).join('; '))
end
end
redirect_back_or_default controller: '/meetings', action: 'show', id: @meeting
@@ -113,10 +113,10 @@ class MeetingContentsController < ApplicationController
result = service.call(@content, :icalendar_notification, include_author: true)
if result.success?
- flash[:notice] = l(:notice_successful_notification)
+ flash[:notice] = I18n.t(:notice_successful_notification)
else
- flash[:error] = l(:error_notification_with_errors,
- recipients: result.errors.map(&:name).join('; '))
+ flash[:error] = I18n.t(:error_notification_with_errors,
+ recipients: result.errors.map(&:name).join('; '))
end
end
redirect_back_or_default controller: '/meetings', action: 'show', id: @meeting
diff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rb
index f3f47cca5fc..1cce21d5129 100644
--- a/modules/meeting/app/controllers/meetings_controller.rb
+++ b/modules/meeting/app/controllers/meetings_controller.rb
@@ -72,9 +72,9 @@ class MeetingsController < ApplicationController
@meeting.agenda.author = User.current
end
if @meeting.save
- text = l(:notice_successful_create)
+ text = I18n.t(:notice_successful_create)
if User.current.time_zone.nil?
- link = l(:notice_timezone_missing, zone: Time.zone)
+ link = I18n.t(:notice_timezone_missing, zone: Time.zone)
text += " #{view_context.link_to(link, { controller: '/my', action: :account }, class: 'link_to_profile')}"
end
flash[:notice] = text.html_safe
@@ -100,7 +100,7 @@ class MeetingsController < ApplicationController
def destroy
@meeting.destroy
- flash[:notice] = l(:notice_successful_delete)
+ flash[:notice] = I18n.t(:notice_successful_delete)
redirect_to action: 'index', project_id: @project
end
@@ -110,7 +110,7 @@ class MeetingsController < ApplicationController
@meeting.participants_attributes = @converted_params.delete(:participants_attributes)
@meeting.attributes = @converted_params
if @meeting.save
- flash[:notice] = l(:notice_successful_update)
+ flash[:notice] = I18n.t(:notice_successful_update)
redirect_to action: 'show', id: @meeting
else
render action: 'edit'
diff --git a/modules/meeting/app/helpers/meeting_contents_helper.rb b/modules/meeting/app/helpers/meeting_contents_helper.rb
index d3d1d55d2ec..73e175a28be 100644
--- a/modules/meeting/app/helpers/meeting_contents_helper.rb
+++ b/modules/meeting/app/helpers/meeting_contents_helper.rb
@@ -70,7 +70,7 @@ module MeetingContentsHelper
data: { confirm: I18n.t(:text_meeting_closing_are_you_sure) },
class: 'meetings--close-meeting-button button') do
op_icon('button--icon icon-locked') +
- content_tag('span', l(:label_meeting_close), class: 'button--text')
+ content_tag('span', I18n.t(:label_meeting_close), class: 'button--text')
end
end
when 'meeting_minutes'
@@ -81,27 +81,25 @@ module MeetingContentsHelper
method: :put,
class: 'button') do
op_icon('button--icon icon-locked') +
- content_tag('span', l(:label_meeting_agenda_close), class: 'button--text')
+ content_tag('span', I18n.t(:label_meeting_agenda_close), class: 'button--text')
end
end
end
end
def open_meeting_agenda_link(content_type, meeting)
- case content_type
- when 'meeting_agenda'
- content_tag :li, '', class: 'toolbar-item' do
- link_to_if_authorized({ controller: '/meeting_agendas',
- action: 'open',
- meeting_id: meeting },
- method: :put,
- class: 'button',
- data: { confirm: l(:text_meeting_agenda_open_are_you_sure) }) do
- op_icon('button--icon icon-unlocked') +
- content_tag('span', l(:label_meeting_open), class: 'button--text')
- end
+ return unless content_type == 'meeting_agenda'
+
+ content_tag :li, '', class: 'toolbar-item' do
+ link_to_if_authorized({ controller: '/meeting_agendas',
+ action: 'open',
+ meeting_id: meeting },
+ method: :put,
+ class: 'button',
+ data: { confirm: I18n.t(:text_meeting_agenda_open_are_you_sure) }) do
+ op_icon('button--icon icon-unlocked') +
+ content_tag('span', I18n.t(:label_meeting_open), class: 'button--text')
end
- when 'meeting_minutes'
end
end
@@ -112,7 +110,7 @@ module MeetingContentsHelper
data: { 'content-type': content_type },
accesskey: accesskey(:edit) do
op_icon('button--icon icon-edit') +
- content_tag('span', l(:label_edit), class: 'button--text')
+ content_tag('span', I18n.t(:label_edit), class: 'button--text')
end
end
end
@@ -126,7 +124,7 @@ module MeetingContentsHelper
title: t(:label_history),
class: 'button') do
op_icon('button--icon icon-wiki') +
- content_tag('span', l(:label_history), class: 'button--text')
+ content_tag('span', I18n.t(:label_history), class: 'button--text')
end
end
end
@@ -138,7 +136,7 @@ module MeetingContentsHelper
method: :put,
class: 'button') do
op_icon('button--icon icon-mail1') +
- content_tag('span', l(:label_notify), class: 'button--text')
+ content_tag('span', I18n.t(:label_notify), class: 'button--text')
end
end
end
@@ -150,7 +148,7 @@ module MeetingContentsHelper
method: :put,
class: 'button') do
op_icon('button--icon icon-calendar2') +
- content_tag('span', l(:label_icalendar), class: 'button--text')
+ content_tag('span', I18n.t(:label_icalendar), class: 'button--text')
end
end
end
diff --git a/modules/meeting/app/models/activities/meeting_activity_provider.rb b/modules/meeting/app/models/activities/meeting_activity_provider.rb
index e9c823cce4d..e3642131251 100644
--- a/modules/meeting/app/models/activities/meeting_activity_provider.rb
+++ b/modules/meeting/app/models/activities/meeting_activity_provider.rb
@@ -109,7 +109,7 @@ class Activities::MeetingActivityProvider < Activities::BaseActivityProvider
end
end_time = start_time + event['meeting_duration'].to_f.hours
- "#{l :label_meeting}: #{event['meeting_title']} (#{format_date start_time} #{format_time start_time, false}-#{format_time end_time, false})"
+ "#{I18n.t(:label_meeting)}: #{event['meeting_title']} (#{format_date start_time} #{format_time start_time, false}-#{format_time end_time, false})"
else
"#{event['meeting_content_type'].constantize.model_name.human}: #{event['meeting_title']}"
end
diff --git a/modules/meeting/app/models/meeting.rb b/modules/meeting/app/models/meeting.rb
index bbfba95db1e..ab5c28b5589 100644
--- a/modules/meeting/app/models/meeting.rb
+++ b/modules/meeting/app/models/meeting.rb
@@ -56,13 +56,13 @@ class Meeting < ApplicationRecord
acts_as_journalized
acts_as_event title: Proc.new { |o|
- "#{l :label_meeting}: #{o.title} \
- #{format_date o.start_time} \
- #{format_time o.start_time, false}-#{format_time o.end_time, false})"
- },
- url: Proc.new { |o| { controller: '/meetings', action: 'show', id: o } },
- author: Proc.new(&:user),
- description: ''
+ "#{I18n.t(:label_meeting)}: #{o.title} \
+ #{format_date o.start_time} \
+ #{format_time o.start_time, false}-#{format_time o.end_time, false})"
+ },
+ url: Proc.new { |o| { controller: '/meetings', action: 'show', id: o } },
+ author: Proc.new(&:user),
+ description: ''
register_on_journal_formatter(:plaintext, 'title')
register_on_journal_formatter(:fraction, 'duration')
diff --git a/modules/pdf_export/app/controllers/export_card_configurations_controller.rb b/modules/pdf_export/app/controllers/export_card_configurations_controller.rb
index ec90916428a..c514e6a4d04 100644
--- a/modules/pdf_export/app/controllers/export_card_configurations_controller.rb
+++ b/modules/pdf_export/app/controllers/export_card_configurations_controller.rb
@@ -50,8 +50,8 @@ class ExportCardConfigurationsController < ApplicationController
def create
@config = ExportCardConfiguration.new(export_card_configurations_params)
if @config.save
- flash[:notice] = l(:notice_successful_create)
- redirect_to :action => 'index'
+ flash[:notice] = I18n.t(:notice_successful_create)
+ redirect_to action: 'index'
else
render "new"
end
@@ -59,41 +59,41 @@ class ExportCardConfigurationsController < ApplicationController
def update
if cannot_update_default
- flash[:error] = l(:error_can_not_change_name_of_default_configuration)
+ flash[:error] = I18n.t(:error_can_not_change_name_of_default_configuration)
render "edit"
elsif @config.update(export_card_configurations_params)
- flash[:notice] = l(:notice_successful_update)
- redirect_to :action => 'index'
+ flash[:notice] = I18n.t(:notice_successful_update)
+ redirect_to action: 'index'
else
render "edit"
end
end
def destroy
- if [email protected]_default? && @config.destroy
- flash[:notice] = l(:notice_successful_delete)
- else
- flash[:notice] = l(:error_can_not_delete_export_card_configuration)
- end
- redirect_to :action => 'index'
+ flash[:notice] = if [email protected]_default? && @config.destroy
+ I18n.t(:notice_successful_delete)
+ else
+ I18n.t(:error_can_not_delete_export_card_configuration)
+ end
+ redirect_to action: 'index'
end
def activate
- if @config.activate
- flash[:notice] = l(:notice_export_card_configuration_activated)
- else
- flash[:notice] = l(:error_can_not_activate_export_card_configuration)
- end
- redirect_to :action => 'index'
+ flash[:notice] = if @config.activate
+ I18n.t(:notice_export_card_configuration_activated)
+ else
+ I18n.t(:error_can_not_activate_export_card_configuration)
+ end
+ redirect_to action: 'index'
end
def deactivate
- if @config.deactivate
- flash[:notice] = l(:notice_export_card_configuration_deactivated)
- else
- flash[:notice] = l(:error_can_not_deactivate_export_card_configuration)
- end
- redirect_to :action => 'index'
+ flash[:notice] = if @config.deactivate
+ I18n.t(:notice_export_card_configuration_deactivated)
+ else
+ I18n.t(:error_can_not_deactivate_export_card_configuration)
+ end
+ redirect_to action: 'index'
end
def show_local_breadcrumb
diff --git a/modules/reporting/app/helpers/reporting_helper.rb b/modules/reporting/app/helpers/reporting_helper.rb
index cd548f156c3..df176cbbca8 100644
--- a/modules/reporting/app/helpers/reporting_helper.rb
+++ b/modules/reporting/app/helpers/reporting_helper.rb
@@ -102,19 +102,19 @@ module ReportingHelper
return I18n.t(:'placeholders.default') if value.blank?
case key.to_sym
- when :activity_id then mapped value, Enumeration, "<i>#{l(:caption_material_costs)}</i>"
+ when :activity_id then mapped value, Enumeration, "<i>#{I18n.t(:caption_material_costs)}</i>"
when :project_id then link_to_project Project.find(value.to_i)
when :user_id, :assigned_to_id, :author_id then link_to_user(User.find_by_id(value.to_i) || DeletedUser.first)
when :tyear, :units then h(value.to_s)
- when :tweek then "#{l(:label_week)} ##{h value}"
+ when :tweek then "#{I18n.t(:label_week)} ##{h value}"
when :tmonth then month_name(value.to_i)
when :category_id then h(Category.find(value.to_i).name)
- when :cost_type_id then mapped value, CostType, l(:caption_labor)
+ when :cost_type_id then mapped value, CostType, I18n.t(:caption_labor)
when :budget_id then budget_link value
when :work_package_id then link_to_work_package(WorkPackage.find(value.to_i))
when :spent_on then format_date(value.to_date)
when :type_id then h(Type.find(value.to_i).name)
- when :week then "#{l(:label_week)} #%s" % value.to_i.modulo(100)
+ when :week then "#{I18n.t(:label_week)} #%s" % value.to_i.modulo(100)
when :priority_id then h(IssuePriority.find(value.to_i).name)
when :version_id then h(Version.find(value.to_i).name)
when :singleton_value then ''
@@ -168,8 +168,8 @@ module ReportingHelper
def cost_type_label(cost_type_id, cost_type_inst = nil, _plural = true)
case cost_type_id
- when -1 then l(:caption_labor)
- when 0 then l(:label_money)
+ when -1 then I18n.t(:caption_labor)
+ when 0 then I18n.t(:label_money)
else (cost_type_inst || CostType.find(cost_type_id)).name
end
end
@@ -192,7 +192,7 @@ module ReportingHelper
struct
end
options = { fields: filters[:operators].keys, set_filter: 1, action: :drill_down }
- link_to '[+]', filters.merge(options), class: 'drill_down', title: l(:description_drill_down)
+ link_to '[+]', filters.merge(options), class: 'drill_down', title: I18n.t(:description_drill_down)
end
##
diff --git a/modules/reporting/lib/widget/table/entry_table.rb b/modules/reporting/lib/widget/table/entry_table.rb
index 9b2b779a0e8..1a30e8b92d7 100644
--- a/modules/reporting/lib/widget/table/entry_table.rb
+++ b/modules/reporting/lib/widget/table/entry_table.rb
@@ -73,7 +73,7 @@ class ::Widget::Table::EntryTable < ::Widget::Table
concat content_tag(:th) {
content_tag(:div, class: 'generic-table--sort-header-outer') do
content_tag(:div, class: 'generic-table--sort-header') do
- content_tag(:span, cost_type.try(:unit_plural) || l(:units))
+ content_tag(:span, cost_type.try(:unit_plural) || I18n.t(:units))
end
end
}
@@ -156,18 +156,18 @@ class ::Widget::Table::EntryTable < ::Widget::Table
with_project(result.fields['project_id']) do
if entry_for(result).editable_by? User.current
if controller_for(result.fields['type']) == 'costlog'
- icons = link_to(icon_wrapper('icon-context icon-edit', l(:button_edit)),
+ icons = link_to(icon_wrapper('icon-context icon-edit', I18n.t(:button_edit)),
action_for(result, action: 'edit'),
class: 'no-decoration-on-hover',
- title: l(:button_edit))
+ title: I18n.t(:button_edit))
- icons << link_to(icon_wrapper('icon-context icon-delete', l(:button_delete)),
+ icons << link_to(icon_wrapper('icon-context icon-delete', I18n.t(:button_delete)),
(action_for(result, action: 'destroy')
.reverse_merge(authenticity_token: form_authenticity_token)),
- data: { confirm: l(:text_are_you_sure) },
+ data: { confirm: I18n.t(:text_are_you_sure) },
method: :delete,
class: 'no-decoration-on-hover',
- title: l(:button_delete))
+ title: I18n.t(:button_delete))
else
icons = content_tag(:'time-entry--trigger-actions-entry',
'',
diff --git a/modules/reporting_engine/lib/widget/controls/apply.rb b/modules/reporting_engine/lib/widget/controls/apply.rb
index 886a4e4b320..5fec902e118 100644
--- a/modules/reporting_engine/lib/widget/controls/apply.rb
+++ b/modules/reporting_engine/lib/widget/controls/apply.rb
@@ -28,7 +28,7 @@
class Widget::Controls::Apply < Widget::Controls
def render
- write link_to(l(:button_apply),
+ write link_to(I18n.t(:button_apply),
'#',
id: 'query-icon-apply-button',
class: 'button -highlight',
diff --git a/modules/reporting_engine/lib/widget/controls/clear.rb b/modules/reporting_engine/lib/widget/controls/clear.rb
index 7d9773fc7f3..04c8465d05b 100644
--- a/modules/reporting_engine/lib/widget/controls/clear.rb
+++ b/modules/reporting_engine/lib/widget/controls/clear.rb
@@ -28,7 +28,7 @@
class Widget::Controls::Clear < Widget::Controls
def render
- write link_to(l(:button_clear),
+ write link_to(I18n.t(:button_clear),
'#',
id: 'query-link-clear',
class: 'button icon-context icon-undo')
diff --git a/modules/reporting_engine/lib/widget/controls/delete.rb b/modules/reporting_engine/lib/widget/controls/delete.rb
index 603fafdff9b..d821d3cdb1a 100644
--- a/modules/reporting_engine/lib/widget/controls/delete.rb
+++ b/modules/reporting_engine/lib/widget/controls/delete.rb
@@ -29,17 +29,23 @@
class Widget::Controls::Delete < Widget::Controls
def render
return '' if @subject.new_record? or !@options[:can_delete]
- button = link_to(l(:button_delete),
+ button = link_to(I18n.t(:button_delete),
'#',
id: 'query-icon-delete',
class: 'button icon-context icon-delete')
popup = content_tag :div, id: 'delete_form', style: 'display:none', class: 'button_form' do
- question = content_tag :p, l(:label_really_delete_question)
+ question = content_tag :p, I18n.t(:label_really_delete_question)
url_opts = { id: @subject.id }
url_opts[request_forgery_protection_token] = form_authenticity_token # if protect_against_forgery?
- opt1 = link_to l(:button_delete), url_for(url_opts), method: :delete, class: 'button -highlight icon-context icon-delete'
- opt2 = link_to l(:button_cancel), '#', id: 'query-icon-delete-cancel', class: 'button icon-context icon-cancel'
+ opt1 = link_to I18n.t(:button_delete),
+ url_for(url_opts),
+ method: :delete,
+ class: 'button -highlight icon-context icon-delete'
+ opt2 = link_to I18n.t(:button_cancel),
+ '#',
+ id: 'query-icon-delete-cancel',
+ class: 'button icon-context icon-cancel'
opt1 + opt2
question + opt1 + opt2
diff --git a/modules/reporting_engine/lib/widget/controls/query_name.rb b/modules/reporting_engine/lib/widget/controls/query_name.rb
index cac56f3ce56..38d3480b844 100644
--- a/modules/reporting_engine/lib/widget/controls/query_name.rb
+++ b/modules/reporting_engine/lib/widget/controls/query_name.rb
@@ -32,7 +32,7 @@ class Widget::Controls::QueryName < Widget::Controls
def render
options = { id: 'query_saved_name', 'data-translations' => translations }
if @subject.new_record?
- name = l(:label_new_report)
+ name = I18n.t(:label_new_report)
icon = ''
else
name = @subject.name
@@ -43,6 +43,6 @@ class Widget::Controls::QueryName < Widget::Controls
end
def translations
- { isPublic: l(:field_is_public) }.to_json
+ { isPublic: I18n.t(:field_is_public) }.to_json
end
end
diff --git a/modules/reporting_engine/lib/widget/controls/save.rb b/modules/reporting_engine/lib/widget/controls/save.rb
index 8e95f9b4b3c..db9947f6b16 100644
--- a/modules/reporting_engine/lib/widget/controls/save.rb
+++ b/modules/reporting_engine/lib/widget/controls/save.rb
@@ -29,7 +29,7 @@
class Widget::Controls::Save < Widget::Controls
def render
return '' if @subject.new_record? or !@options[:can_save]
- write link_to(l(:button_save),
+ write link_to(I18n.t(:button_save),
'#',
id: 'query-breadcrumb-save',
class: 'button icon-context icon-save',
diff --git a/modules/reporting_engine/lib/widget/controls/save_as.rb b/modules/reporting_engine/lib/widget/controls/save_as.rb
index cf2acaef974..4e2fd3e1884 100644
--- a/modules/reporting_engine/lib/widget/controls/save_as.rb
+++ b/modules/reporting_engine/lib/widget/controls/save_as.rb
@@ -29,10 +29,10 @@
class Widget::Controls::SaveAs < Widget::Controls
def render
if @subject.new_record?
- link_name = l(:button_save)
+ link_name = I18n.t(:button_save)
icon = 'icon-save'
else
- link_name = l(:button_save_as)
+ link_name = I18n.t(:button_save_as)
icon = 'icon-save'
end
button = link_to(link_name, '#', id: 'query-icon-save-as', class: "button icon-context #{icon}")
@@ -83,13 +83,13 @@ class Widget::Controls::SaveAs < Widget::Controls
end
def render_popup_buttons
- save = link_to(l(:button_save),
+ save = link_to(I18n.t(:button_save),
'#',
id: 'query-icon-save-button',
class: 'button -highlight icon-context icon-save',
:"data-target" => url_for(action: 'create', set_filter: '1'))
- cancel = link_to(l(:button_cancel),
+ cancel = link_to(I18n.t(:button_cancel),
'#',
id: 'query-icon-save-as-cancel',
class: 'button icon-context icon-cancel')
diff --git a/modules/reporting_engine/lib/widget/filters.rb b/modules/reporting_engine/lib/widget/filters.rb
index 3126c38fa04..1cd0c2dda96 100644
--- a/modules/reporting_engine/lib/widget/filters.rb
+++ b/modules/reporting_engine/lib/widget/filters.rb
@@ -32,7 +32,7 @@ class Widget::Filters < ::Widget::Base
spacer = content_tag :li, '', class: 'advanced-filters--spacer hide-when-print'
add_filter = content_tag :li, id: 'add_filter_block', class: 'advanced-filters--add-filter hide-when-print' do
- add_filter_label = label_tag 'add_filter_select', l(:label_filter_add),
+ add_filter_label = label_tag 'add_filter_select', I18n.t(:label_filter_add),
class: 'advanced-filters--add-filter-label'
add_filter_label += label_tag 'add_filter_select', I18n.t('js.filter.description.text_open_filter') + ' ' +
I18n.t('js.filter.description.text_close_filter'),
diff --git a/modules/reporting_engine/lib/widget/filters/date.rb b/modules/reporting_engine/lib/widget/filters/date.rb
index e0a6f1ad959..eaf09598d49 100644
--- a/modules/reporting_engine/lib/widget/filters/date.rb
+++ b/modules/reporting_engine/lib/widget/filters/date.rb
@@ -38,7 +38,7 @@ class Widget::Filters::Date < Widget::Filters::Base
write(content_tag(:span, class: 'advanced-filters--filter-value -binary') do
label1 = label_tag "#{id_prefix}arg_1_val",
- h(filter_class.label) + ' ' + l(:label_filter_value),
+ h(filter_class.label) + ' ' + I18n.t(:label_filter_value),
class: 'hidden-for-sighted'
arg1 = content_tag :span, id: "#{id_prefix}arg_1" do
@@ -51,7 +51,7 @@ class Widget::Filters::Date < Widget::Filters::Base
end
label2 = label_tag "#{id_prefix}arg_2_val",
- h(filter_class.label) + ' ' + l(:label_filter_value),
+ h(filter_class.label) + ' ' + I18n.t(:label_filter_value),
class: 'hidden-for-sighted'
arg2 = content_tag :span, id: "#{id_prefix}arg_2", class: 'advanced-filters--filter-value2' do
diff --git a/modules/reporting_engine/lib/widget/filters/multi_values.rb b/modules/reporting_engine/lib/widget/filters/multi_values.rb
index 18f7af7c63c..5426abc1253 100644
--- a/modules/reporting_engine/lib/widget/filters/multi_values.rb
+++ b/modules/reporting_engine/lib/widget/filters/multi_values.rb
@@ -42,17 +42,22 @@ class Widget::Filters::MultiValues < Widget::Filters::Base
:"data-filter-name" => filter_class.underscore_name }
box_content = ''.html_safe
label = label_tag "#{filter_class.underscore_name}_arg_1_val",
- h(filter_class.label) + ' ' + l(:label_filter_value),
+ h(filter_class.label) + ' ' + I18n.t(:label_filter_value),
class: 'hidden-for-sighted'
box = content_tag :select, select_options, id: "#{filter_class.underscore_name}_select_1" do
render_widget Widget::Filters::Option, filter, to: box_content unless @options[:lazy]
end
- plus = content_tag :a, href: '#', class: 'form-label filter_multi-select -transparent',
- :"data-filter-name" => filter_class.underscore_name,
- title: l(:description_multi_select) do
- content_tag :span, '', class: 'icon-context icon-button icon-add icon4', title: l(:label_enable_multi_select) do
- content_tag :span, l(:label_enable_multi_select), class: 'hidden-for-sighted'
+ plus = content_tag :a,
+ href: '#',
+ class: 'form-label filter_multi-select -transparent',
+ :"data-filter-name" => filter_class.underscore_name,
+ title: I18n.t(:description_multi_select) do
+ content_tag :span,
+ '',
+ class: 'icon-context icon-button icon-add icon4',
+ title: I18n.t(:label_enable_multi_select) do
+ content_tag :span, I18n.t(:label_enable_multi_select), class: 'hidden-for-sighted'
end
end
diff --git a/modules/reporting_engine/lib/widget/filters/operators.rb b/modules/reporting_engine/lib/widget/filters/operators.rb
index 306133ca397..0612065feb0 100644
--- a/modules/reporting_engine/lib/widget/filters/operators.rb
+++ b/modules/reporting_engine/lib/widget/filters/operators.rb
@@ -48,7 +48,7 @@ class Widget::Filters::Operators < Widget::Filters::Base
end.join.html_safe
end
label1 = content_tag :label,
- h(filter_class.label) + ' ' + l(:label_operator) + ' ' + I18n.t('js.filter.description.text_open_filter'),
+ hidden_for_sighted_label,
for: "operators[#{filter_class.underscore_name}]",
class: 'hidden-for-sighted'
label = content_tag :label do
@@ -59,4 +59,8 @@ class Widget::Filters::Operators < Widget::Filters::Base
hide_select_box ? label1 + select_box + label : label1 + select_box
end)
end
+
+ def hidden_for_sighted_label
+ h(filter_class.label) + ' ' + I18n.t(:label_operator) + ' ' + I18n.t('js.filter.description.text_open_filter')
+ end
end
diff --git a/modules/reporting_engine/lib/widget/filters/option.rb b/modules/reporting_engine/lib/widget/filters/option.rb
index ae6c07509a1..bfd5e48e894 100644
--- a/modules/reporting_engine/lib/widget/filters/option.rb
+++ b/modules/reporting_engine/lib/widget/filters/option.rb
@@ -39,18 +39,18 @@ class Widget::Filters::Option < Widget::Filters::Base
write((@options[:content] || filter_class.available_values).map do |name, id, *args|
options = args.first || {} # optional configuration for values
level = options[:level] # nesting_level is optional for values
- name = l(name) if name.is_a? Symbol
- name = name.empty? ? l(:label_none) : name
+ name = I18n.t(name) if name.is_a? Symbol
+ name = name.empty? ? I18n.t(:label_none) : name
name_prefix = ((level && level > 0) ? (' ' * 2 * level + '> ') : '')
- unless options[:optgroup]
+ if options[:optgroup]
+ tag :optgroup, label: I18n.t(:label_sector)
+ else
opts = { value: id }
if (Array(filter.values).map(&:to_s).include? id.to_s) || (first && Array(filter.values).empty?)
opts[:selected] = 'selected'
end
first = false
content_tag(:option, opts) { name_prefix + name }
- else
- tag :optgroup, label: l(:label_sector)
end
end.join.html_safe)
end
diff --git a/modules/reporting_engine/lib/widget/filters/remove_button.rb b/modules/reporting_engine/lib/widget/filters/remove_button.rb
index 0f777ced02a..c5539381775 100644
--- a/modules/reporting_engine/lib/widget/filters/remove_button.rb
+++ b/modules/reporting_engine/lib/widget/filters/remove_button.rb
@@ -34,7 +34,7 @@ class Widget::Filters::RemoveButton < Widget::Filters::Base
hidden_field = tag :input, id: "rm_#{filter_class.underscore_name}",
name: 'fields[]', type: 'hidden', value: ''
button = content_tag(:a, href: "#", class: "filter_rem") do
- icon_wrapper('icon-context advanced-filters--remove-filter-icon', l(:description_remove_filter))
+ icon_wrapper('icon-context advanced-filters--remove-filter-icon', I18n.t(:description_remove_filter))
end
write(content_tag(:div, hidden_field + button, id: "rm_box_#{filter_class.underscore_name}",
diff --git a/modules/reporting_engine/lib/widget/filters/text_box.rb b/modules/reporting_engine/lib/widget/filters/text_box.rb
index 54dd4179c1b..174396739dc 100644
--- a/modules/reporting_engine/lib/widget/filters/text_box.rb
+++ b/modules/reporting_engine/lib/widget/filters/text_box.rb
@@ -32,7 +32,7 @@ require_dependency 'widget/filters/base'
class Widget::Filters::TextBox < Widget::Filters::Base
def render
label = content_tag :label,
- "#{h(filter_class.label)} #{l(:label_filter_value)}",
+ "#{h(filter_class.label)} #{I18n.t(:label_filter_value)}",
for: "#{filter_class.underscore_name}_arg_1_val",
class: 'hidden-for-sighted'
diff --git a/modules/reporting_engine/lib/widget/group_bys.rb b/modules/reporting_engine/lib/widget/group_bys.rb
index e530cce2d18..8bfffa28f61 100644
--- a/modules/reporting_engine/lib/widget/group_bys.rb
+++ b/modules/reporting_engine/lib/widget/group_bys.rb
@@ -50,7 +50,7 @@ class Widget::GroupBys < Widget::Base
:'data-initially-selected' => initially_selected.to_json.gsub('"', "'") do
out = content_tag :span, class: 'group-by--caption grid-content shrink' do
content_tag :span do
- l(:"label_#{type}")
+ I18n.t(:"label_#{type}")
end
end
@@ -59,17 +59,17 @@ class Widget::GroupBys < Widget::Base
out += content_tag :span,
class: 'group-by--control grid-content shrink' do
label = label_tag "group-by--add-#{type}",
- l(:"label_group_by_add") + ' ' +
+ I18n.t(:"label_group_by_add") + ' ' +
I18n.t('js.filter.description.text_open_filter'),
class: 'hidden-for-sighted'
label += content_tag :select, id: "group-by--add-#{type}", class: 'advanced-filters--select' do
- content = content_tag :option, l(:label_group_by_add), value: ''
+ content = content_tag :option, I18n.t(:label_group_by_add), value: ''
content += engine::GroupBy.all_grouped.sort_by do |label, _group_by_ary|
- l(label)
+ I18n.t(label)
end.map do |label, group_by_ary|
- content_tag :optgroup, label: h(l(label)) do
+ content_tag :optgroup, label: h(I18n.t(label)) do
render_options group_by_ary
end
end.join.html_safe
diff --git a/modules/reporting_engine/lib/widget/settings/fieldset.rb b/modules/reporting_engine/lib/widget/settings/fieldset.rb
index 885607f2482..05615bfd6d7 100644
--- a/modules/reporting_engine/lib/widget/settings/fieldset.rb
+++ b/modules/reporting_engine/lib/widget/settings/fieldset.rb
@@ -47,7 +47,7 @@ class Widget::Settings::Fieldset < Widget::Base
tooltip: "#{@type}-legend-tip",
class: 'form--fieldset-legend',
id: hash.to_s) do
- content_tag(:a, href: '#') do l(@label) end
+ content_tag(:a, href: '#') { I18n.t(@label) }
end
html + yield
end)
diff --git a/modules/reporting_engine/lib/widget/table.rb b/modules/reporting_engine/lib/widget/table.rb
index 631df88a222..5dc78ee299c 100644
--- a/modules/reporting_engine/lib/widget/table.rb
+++ b/modules/reporting_engine/lib/widget/table.rb
@@ -69,7 +69,8 @@ class Widget::Table < Widget::Base
write('<!-- table start -->')
if @subject.result.count <= 0
write(content_tag(:div, '', class: 'generic-table--no-results-container') do
- content_tag(:i, '', class: 'icon-info1') + content_tag(:h2, l(:no_results_title_text), class: 'generic-table--no-results-title')
+ content_tag(:i, '', class: 'icon-info1') +
+ content_tag(:h2, I18n.t(:no_results_title_text), class: 'generic-table--no-results-title')
end)
else
str = render_widget(resolve_table, @subject, @options.reverse_merge(to: @output))
diff --git a/spec_legacy/fixtures/diffs/subversion.diff b/spec_legacy/fixtures/diffs/subversion.diff
index 9b6c9d08603..ddea941d475 100644
--- a/spec_legacy/fixtures/diffs/subversion.diff
+++ b/spec_legacy/fixtures/diffs/subversion.diff
@@ -3,13 +3,13 @@
--- app/views/settings/_general.rhtml (revision 2094)
+++ app/views/settings/_general.rhtml (working copy)
@@ -48,6 +48,9 @@
- <p><label><%= l(:setting_feeds_limit) %></label>
+ <p><label><%= I18n.t(:setting_feeds_limit) %></label>
<%= text_field_tag 'settings[feeds_limit]', Setting.feeds_limit, :size => 6 %></p>
-+<p><label><%= l(:setting_diff_max_lines_displayed) %></label>
++<p><label><%= I18n.t(:setting_diff_max_lines_displayed) %></label>
+<%= text_field_tag 'settings[diff_max_lines_displayed]', Setting.diff_max_lines_displayed, :size => 6 %></p>
+
- <p><label><%= l(:setting_gravatar_enabled) %></label>
+ <p><label><%= I18n.t(:setting_gravatar_enabled) %></label>
<%= check_box_tag 'settings[gravatar_enabled]', 1, Setting.gravatar_enabled? %><%= hidden_field_tag 'settings[gravatar_enabled]', 0 %></p>
</div>
Index: app/views/common/_diff.rhtml
@@ -28,7 +28,7 @@ Index: app/views/common/_diff.rhtml
</div>
<% end -%>
+
-+<%= l(:text_diff_truncated) if diff.truncated? %>
++<%= I18n.t(:text_diff_truncated) if diff.truncated? %>
Index: lang/lt.yml
===================================================================
--- config/settings.yml (revision 2094)
diff --git a/spec_legacy/unit/lib/redmine/i18n_spec.rb b/spec_legacy/unit/lib/redmine/i18n_spec.rb
index d951317f231..23a60df6e1f 100644
--- a/spec_legacy/unit/lib/redmine/i18n_spec.rb
+++ b/spec_legacy/unit/lib/redmine/i18n_spec.rb
@@ -47,11 +47,11 @@ describe Redmine::I18n do
refute_equal 'default', ::I18n.l(Date.today, format: :default), "date.formats.default missing in #{lang}"
refute_equal 'time', ::I18n.l(Time.now, format: :time), "time.formats.time missing in #{lang}"
}.not_to raise_error
- assert l('date.day_names').is_a?(Array)
- assert_equal 7, l('date.day_names').size
+ assert I18n.t('date.day_names').is_a?(Array)
+ assert_equal 7, I18n.t('date.day_names').size
- assert l('date.month_names').is_a?(Array)
- assert_equal 13, l('date.month_names').size
+ assert I18n.t('date.month_names').is_a?(Array)
+ assert_equal 13, I18n.t('date.month_names').size
end
end
@@ -111,14 +111,14 @@ describe Redmine::I18n do
it 'should fallback' do
::I18n.backend.store_translations(:en, untranslated: 'Untranslated string')
::I18n.locale = 'en'
- assert_equal 'Untranslated string', l(:untranslated)
+ assert_equal 'Untranslated string', I18n.t(:untranslated)
::I18n.locale = 'de'
- assert_equal 'Untranslated string', l(:untranslated)
+ assert_equal 'Untranslated string', I18n.t(:untranslated)
::I18n.backend.store_translations(:de, untranslated: 'Keine Übersetzung')
::I18n.locale = 'en'
- assert_equal 'Untranslated string', l(:untranslated)
+ assert_equal 'Untranslated string', I18n.t(:untranslated)
::I18n.locale = 'de'
- assert_equal 'Keine Übersetzung', l(:untranslated)
+ assert_equal 'Keine Übersetzung', I18n.t(:untranslated)
end
end