diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 8b68cbb..edcd95c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -19,7 +19,7 @@ def tyrant rescue_from Trailblazer::NotAuthorizedError, with: :user_not_authorized def user_not_authorized - flash[:message] = "Not authorized, my friend." + flash[:message] = t('errors.user_not_authorized') redirect_to root_path end end diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index ac01130..b0b7e0e 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -9,7 +9,7 @@ def create @thing = Thing.find(params[:thing_id]) # UI-specific logic! run Comment::Create do |op| - flash[:notice] = "Created comment for \"#{op.thing.name}\"" + flash[:notice] = t('comments.success_message', thing: op.thing.name) return redirect_to thing_path(op.thing) end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 5e57cfc..623e29e 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -5,7 +5,7 @@ def sign_up_form def sign_up run Session::SignUp do |op| - flash[:notice] = "Please log in now!" + flash[:notice] = t('session.log_in') return redirect_to sessions_sign_in_form_path end @@ -46,7 +46,7 @@ def wake_up_form def wake_up run Session::ChangePassword do - flash[:notice] = "Password changed." + flash[:notice] = t('session.password_change_message') redirect_to sessions_sign_in_form_path # TODO: user profile. return end # TODO: require_original: true diff --git a/app/controllers/things_controller.rb b/app/controllers/things_controller.rb index 35856b3..fa57bd6 100644 --- a/app/controllers/things_controller.rb +++ b/app/controllers/things_controller.rb @@ -41,7 +41,7 @@ def create_comment @thing = @thing_op.model run Comment::Create, params: params.merge(thing_id: params[:id]) do |op| # overrides @model and @form! - flash[:notice] = "Created comment for \"#{op.thing.name}\"" + flash[:notice] = t('comments.success_message', thing: op.thing.name) return redirect_to thing_path(op.thing) end diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index 4952a01..c211e95 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -1,6 +1,6 @@ .row %h3 - Welcome to Gemgem! + = t('home.welcome_message') .row = concept("thing/cell/grid") \ No newline at end of file diff --git a/app/views/layouts/_navigation_links.html.haml b/app/views/layouts/_navigation_links.html.haml index 787ceb5..b6e8636 100644 --- a/app/views/layouts/_navigation_links.html.haml +++ b/app/views/layouts/_navigation_links.html.haml @@ -1,9 +1,9 @@ %li - = link_to "Start discussion!", new_thing_path + = link_to t('things.new'), new_thing_path - if tyrant.signed_in? %li - = link_to "Hi, #{tyrant.current_user.email}", user_path(tyrant.current_user) + = link_to t('session.hi_user', user: tyrant.current_user.email), user_path(tyrant.current_user) %li = link_to "Sign out", sessions_sign_out_path - else diff --git a/app/views/sessions/sign_in_form.html.haml b/app/views/sessions/sign_in_form.html.haml index f3f14fd..e4ba561 100644 --- a/app/views/sessions/sign_in_form.html.haml +++ b/app/views/sessions/sign_in_form.html.haml @@ -1,4 +1,5 @@ -%h1 Come in! +%h1 + = t('session.sign_in_message') = simple_form_for(@form, url: sessions_sign_in_path, as: :session) do |f| .row diff --git a/app/views/sessions/sign_up_form.html.haml b/app/views/sessions/sign_up_form.html.haml index 2314b47..58e22ec 100644 --- a/app/views/sessions/sign_up_form.html.haml +++ b/app/views/sessions/sign_up_form.html.haml @@ -1,4 +1,5 @@ -%h1 Come join us! +%h1 + = t('session.sign_up_message') = simple_form_for(@form, url: sessions_sign_up_path) do |f| .row diff --git a/config/locales/en.yml b/config/locales/en.yml index 0653957..a4bd150 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -21,3 +21,17 @@ en: hello: "Hello world" + home: + welcome_message: Welcome to Gemgem! + session: + log_in: Please log in now! + sign_up_message: Come join us! + sign_in_message: Come in! + password_change_message: Password changed. + hi_user: Hi, %{user} + errors: + user_not_authorized: Not authorized, my friend. + comments: + success_message: Created comment for %{thing} + things: + new: Start discussion!