Skip to content
This repository was archived by the owner on May 29, 2020. It is now read-only.

Commit a6ac5d8

Browse files
committed
logged in / logged out を日本語化
1 parent 12ab178 commit a6ac5d8

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

app/controllers/sessions_controller.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ def create
2020
if user && user.authenticate(user_params[:password])
2121
reset_session
2222
session[:user_id] = user.id
23-
format.html { redirect_to root_url, :notice => "Logged in" }
23+
format.html { redirect_to root_url, :notice => I18n.t("helpers.notices.logged_in") }
2424
format.js { head :ok }
2525
else
2626
format.html {
27-
flash.now[:alert] = "ログインできません。"
27+
flash.now[:alert] = I18n.t("helpers.notices.login_failed")
2828
@user = User.new(user_params.permit(:username))
2929
render "new"
3030
}
@@ -39,7 +39,7 @@ def create
3939
def destroy
4040
reset_session
4141
respond_to do |format|
42-
format.html { redirect_to root_url, :notice => "Logged out" }
42+
format.html { redirect_to root_url, :notice => I18n.t("helpers.notices.logged_out") }
4343
format.js { head :ok }
4444
end
4545
end

config/locales/ja.bootstrap.yml

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ ja:
1818
created: "%{model}を作成しました。"
1919
updated: "%{model}を更新しました。"
2020
destroyed: "%{model}を削除しました。"
21+
logged_in: ログインしました。
22+
logged_out: ログアウトしました。
23+
login_failed: ログインできません。
2124

2225
views:
2326
pagination:

0 commit comments

Comments
 (0)