このコミットが含まれているのは:
2026-10-17 19:59:18 +09:00
コミット f063fc54bb
17個のファイルの変更、276行の追加、123行の削除
+8 -1
ファイルの表示
@@ -10,6 +10,7 @@ class ApplicationController < ActionController::API
before_action :reject_banned_ip_address!
before_action :authenticate_user
before_action :reject_banned_user!
before_action :validate_explicit_locale!
def current_user = @current_user
@@ -99,6 +100,8 @@ class ApplicationController < ActionController::API
end
def resolve_locale!
return @resolved_locale if defined?(@resolved_locale)
code = params.fetch(:locale, 'ja')
unless code.is_a?(String) && Locale.codes.value?(code)
raise UnsupportedLocale
@@ -107,6 +110,10 @@ class ApplicationController < ActionController::API
locale = Locale.find_by(code:)
raise UnsupportedLocale unless locale && locale.deprecated_at.nil?
locale
@resolved_locale = locale
end
def validate_explicit_locale!
resolve_locale! if params.key?(:locale)
end
end