English localization for all WebDAV requests

This commit is contained in:
Karel Pičman 2023-08-31 10:25:45 +02:00
parent b0d991eb58
commit 013993b48d
2 changed files with 38 additions and 1 deletions

View File

@ -33,7 +33,8 @@ module RedmineDmsf
run Dav4rack::Handler.new( run Dav4rack::Handler.new(
root_uri_path: path, root_uri_path: path,
resource_class: RedmineDmsf::Webdav::ResourceProxy, resource_class: RedmineDmsf::Webdav::ResourceProxy,
allow_unauthenticated_options_on_root: true allow_unauthenticated_options_on_root: true,
controller_class: DmsfController
) )
end end
end end

View File

@ -0,0 +1,36 @@
# frozen_string_literal: true
# Redmine plugin for Document Management System "Features"
#
# Copyright © 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright © 2011-23 Karel Pičman <karel.picman@kontron.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module RedmineDmsf
module Webdav
class DmsfController < Dav4rack::Controller
include Redmine::I18n
include AbstractController::Callbacks
around_action :switch_locale
def switch_locale(&action)
# Switch the locale to English for WebDAV requests in order to have log messages in English
I18n.with_locale(:en, &action)
end
end
end
end