made flash messages translatable

This commit is contained in:
MrZYX 2010-11-04 18:10:10 +01:00
parent 63a5fdb000
commit 1102fcd565
9 changed files with 36 additions and 17 deletions

View file

@ -48,7 +48,7 @@ class InvitationsController < Devise::InvitationsController
def check_token
if User.find_by_invitation_token(params['invitation_token']).nil?
flash[:error] = "Invitation token not found"
flash[:error] = I18n.t 'invitations.check_token.not_found'
redirect_to root_url
end
end

View file

@ -32,7 +32,7 @@ class PeopleController < ApplicationController
@posts = current_user.visible_posts(:person_id => @person.id).paginate :page => params[:page], :order => 'created_at DESC'
respond_with @person
else
flash[:error] = "Person does not exist!"
flash[:error] = I18n.t 'people.show.does_not_exist'
redirect_to people_path
end
end
@ -68,9 +68,9 @@ class PeopleController < ApplicationController
prep_image_url(params[:person])
if current_user.update_profile params[:person][:profile]
flash[:notice] = "Profile updated"
flash[:notice] = I18n.t 'people.update.updated'
else
flash[:error] = "Failed to update profile"
flash[:error] = I18n.t 'people.update.failed'
end
if params[:getting_started]

View file

@ -62,7 +62,7 @@ class RequestsController < ApplicationController
if params[:getting_started]
redirect_to getting_started_path(:step=>params[:getting_started])
else
flash[:notice] = "we tried our best to send a message to #{account}" unless flash[:error]
flash[:notice] = I18n.t('requests.create.tried', :account => account) unless flash[:error]
respond_with :location => aspects_manage_path
return
end

View file

@ -31,14 +31,14 @@ class ServicesController < ApplicationController
:uid => auth['uid'])
end
flash[:notice] = "Authentication successful."
flash[:notice] = I18n.t 'services.create.success'
redirect_to services_url
end
def destroy
@service = current_user.services.find(params[:id])
@service.destroy
flash[:notice] = "Successfully destroyed authentication."
flash[:notice] = I18n.t 'services.destroy.success'
redirect_to services_url
end
end

View file

@ -31,15 +31,15 @@ class UsersController < ApplicationController
if params[:user][:password] && params[:user][:password_confirmation]
if @user.update_attributes(:password => params[:user][:password], :password_confirmation => params[:user][:password_confirmation])
flash[:notice] = "Password Changed"
flash[:notice] = I18n.t 'users.update.password_changed'
else
flash[:error] = "Password Change Failed"
flash[:error] = I18n.t 'users.update.password_not_changed'
end
elsif params[:user][:language]
if @user.update_attributes(:language => params[:user][:language])
flash[:notice] = "Language Changed"
flash[:notice] = I18n.t 'users.update.language_changed'
else
flash[:error] = "Language Change Failed"
flash[:error] = I18n.t 'users.update.language_not_changed'
end
end
@ -50,7 +50,7 @@ class UsersController < ApplicationController
def destroy
current_user.destroy
sign_out current_user
flash[:notice] = t('user.destroy')
flash[:notice] = I18n.t 'users.destroy'
redirect_to root_path
end
@ -63,7 +63,7 @@ class UsersController < ApplicationController
render :xml => director.build(ostatus_builder), :content_type => 'application/atom+xml'
else
flash[:error] = "User #{params[:username]} does not exist!"
flash[:error] = I18n.t 'users.public.does_not_exists', :username => params[:username]
redirect_to root_url
end
end

View file

@ -9,7 +9,7 @@
%ul#settings_nav
%li=link_to t('profile'), edit_person_path(current_user.person)
%li=link_to t('account'), edit_user_path(current_user)
%li=link_to t('services'), services_path
%li=link_to t('_services'), services_path
.span-19.prepend-5.last
= form_for @person, :html => { :multipart => true } do |person|

View file

@ -8,7 +8,7 @@
%ul#settings_nav
%li=link_to t('profile'), edit_person_path(current_user.person)
%li=link_to t('account'), edit_user_path(current_user)
%li=link_to t('services'), services_path
%li=link_to t('_services'), services_path
.span-19.prepend-5.last
%h2

View file

@ -18,7 +18,7 @@
%ul#settings_nav
%li=link_to t('profile'), edit_person_path(current_user.person)
%li=link_to t('account'), edit_user_path(current_user)
%li=link_to t('services'), services_path
%li=link_to t('_services'), services_path
.span-19.prepend-5.last
%h2

View file

@ -10,7 +10,7 @@ en:
settings: "Settings"
profile: "Profile"
account: "Account"
services: "Services"
_services: "Services"
_photos: "photos"
stream: "stream"
ok: "OK"
@ -156,6 +156,13 @@ en:
'step_1':
you_dont_have_any_photos: "You don't have any photos! Go to the"
page_to_upload_some: "page to upload some."
update:
password_changed: "Password Changed"
password_not_changed: "Password Change Failed"
language_changed: "Language Changed"
language_not_changed: "Language Change Failed"
public:
does_not_exist: "User %{username} does not exist!"
comments:
new_comment:
comment: "Comment"
@ -215,6 +222,8 @@ en:
message: 'Message:'
send_an_invitation: 'Send an invitation'
send_invitation: 'Send invitation'
check_token:
not_found: "Invitation token not found"
status_messages:
new_status_message:
tell_me_something_good: "tell me something good"
@ -258,6 +267,7 @@ en:
not_friends: "You're currently not friends with %{name}"
request_people: "If you'd like, you can request to place him/her in one of your aspects."
already_requested: "You have already sent a request to %{name}."
does_not_exist: "Person does not exist!"
edit:
info_available_to: "This info will be available to whomever you connect with on Diaspora."
your_profile: "Your profile"
@ -280,6 +290,9 @@ en:
allow_search: "Allow for people to search for you"
profile_photo_upload:
or_select_one: "or select one from your already existing"
update:
updated: "Profile updated"
failed: "Failed to update profile"
requests:
new_request:
add_a_new_friend_to: "Add a new friend to"
@ -299,3 +312,9 @@ en:
already_friends: "You are already friends with %{destination_url}!"
success: "A friend request was sent to %{destination_url}."
horribly_wrong: "Something went horribly wrong."
tried: "we tried our best to send a message to %{account}"
services:
create:
success: "Authentication successful."
destroy:
success: "Successfully destroyed authentication."