Added locale selection to preferences

Mostly completed transition to full i18n
Incorporated german translations by Ulf Klose <ulf.klose@gmail.com>
This commit is contained in:
Marcus Ilgner 2011-01-16 18:14:07 +01:00
parent d57bd479f9
commit 338d4bb5a6
44 changed files with 1071 additions and 209 deletions

View file

@ -35,15 +35,15 @@ class UsersController < ApplicationController
end
if User.no_users_yet?
@page_title = "TRACKS::Sign up as the admin user"
@heading = "Welcome to TRACKS. To get started, please create an admin account:"
@page_title = t('users.new_user_title')
@heading = t('users.first_user_heading')
@user = get_new_user
elsif (@user && @user.is_admin?) || SITE_CONFIG['open_signups']
@page_title = "TRACKS::Sign up a new user"
@heading = "Sign up a new user:"
@page_title = t('users.new_user_title')
@heading = t('users.new_user_heading')
@user = get_new_user
else # all other situations (i.e. a non-admin is logged in, or no one is logged in, but we have some users)
@page_title = "TRACKS::No signups"
@page_title = t('users.no_signups_title')
@admin_email = User.find_admin.preference.admin_email
render :action => "nosignup", :layout => "login"
return
@ -66,7 +66,7 @@ class UsersController < ApplicationController
respond_to do |format|
format.html do
unless User.no_users_yet? || (@user && @user.is_admin?) || SITE_CONFIG['open_signups']
@page_title = "No signups"
@page_title = t('users.no_signups_title')
@admin_email = User.find_admin.preference.admin_email
render :action => "nosignup", :layout => "login"
return
@ -98,10 +98,10 @@ class UsersController < ApplicationController
user.is_admin = true if first_user_signing_up
if user.save
@user = User.authenticate(user.login, params['user']['password'])
@user.create_preference
@user.create_preference({:locale => I18n.locale})
@user.save
session['user_id'] = @user.id if first_user_signing_up
notify :notice, "Signup successful for user #{@user.login}."
notify :notice, t('users.signup_successful', :username => @user.login)
redirect_back_or_home
end
return
@ -121,7 +121,7 @@ class UsersController < ApplicationController
end
user.password_confirmation = params[:request][:password]
if user.save
render :text => "User created.", :status => 200
render :text => t('users.user_created'), :status => 200
else
render_failure user.errors.to_xml
end
@ -139,9 +139,9 @@ class UsersController < ApplicationController
respond_to do |format|
format.html do
if @saved
notify :notice, "Successfully deleted user #{@deleted_user.login}", 2.0
notify :notice, t('users.successfully_deleted_user', :username => @deleted_user.login), 2.0
else
notify :error, "Failed to delete user #{@deleted_user.login}", 2.0
notify :error, t('users.failed_to_delete_user', :username => @deleted_user.login), 2.0
end
redirect_to users_url
end
@ -152,12 +152,12 @@ class UsersController < ApplicationController
def change_password
@page_title = "TRACKS::Change password"
@page_title = t('users.change_password_title')
end
def update_password
@user.change_password(params[:updateuser][:password], params[:updateuser][:password_confirmation])
notify :notice, "Password updated."
notify :notice, t('users.password_updated')
redirect_to preferences_path
rescue Exception => error
notify :error, error.message
@ -165,7 +165,7 @@ class UsersController < ApplicationController
end
def change_auth_type
@page_title = "TRACKS::Change authentication type"
@page_title = t('users.change_auth_type_title')
end
def update_auth_type
@ -177,10 +177,10 @@ class UsersController < ApplicationController
@user.auth_type = 'open_id'
@user.open_id_url = identity_url
if @user.save
notify :notice, "You have successfully verified #{identity_url} as your identity and set your authentication type to Open ID."
notify :notice, t('users.openid_url_verified', :url => identity_url)
else
debugger
notify :warning, "You have successfully verified #{identity_url} as your identity but there was a problem saving your authentication preferences."
notify :warning, t('users.openid_ok_pref_failed', :url => identity_url)
end
redirect_to preferences_path
else
@ -192,10 +192,10 @@ class UsersController < ApplicationController
end
@user.auth_type = params[:user][:auth_type]
if @user.save
notify :notice, "Authentication type updated."
notify :notice, t('users.auth_type_updated')
redirect_to preferences_path
else
notify :warning, "There was a problem updating your authentication type: #{ @user.errors.full_messages.join(', ')}"
notify :warning, t('users.auth_type_update_error', :error_messages => @user.errors.full_messages.join(', '))
redirect_to :action => 'change_auth_type'
end
end
@ -203,7 +203,7 @@ class UsersController < ApplicationController
def refresh_token
@user.generate_token
@user.save!
notify :notice, "New token successfully generated"
notify :notice, t('users.new_token_generated')
redirect_to preferences_path
end