diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 90395e5d..bfc99fe1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -50,7 +50,8 @@ class ApplicationController < ActionController::Base end def set_locale - locale = params[:locale] || request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first + locale = params[:locale] + locale = locale || request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first if request.env['HTTP_ACCEPT_LANGUAGE'] I18n.locale = I18n::available_locales.include?(locale) ? locale : I18n.default_locale logger.debug("Selected '#{I18n.locale}' as locale") end diff --git a/app/models/project.rb b/app/models/project.rb index 07af5cbe..1860a51b 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -71,8 +71,8 @@ class Project < ActiveRecord::Base def self.feed_options(user) { - :title => t('models.project.feed_title'), - :description => t('models.project.feed_description', :username => user.display_name) + :title => I18n.t('models.project.feed_title'), + :description => I18n.t('models.project.feed_description', :username => user.display_name) } end diff --git a/app/models/todo.rb b/app/models/todo.rb index 1888e72b..6fe3e5ae 100644 --- a/app/models/todo.rb +++ b/app/models/todo.rb @@ -135,7 +135,7 @@ class Todo < ActiveRecord::Base def validate if !show_from.blank? && show_from < user.date - errors.add("show_from", t('models.todo.error_date_must_be_future')) + errors.add("show_from", I18n.t('models.todo.error_date_must_be_future')) end errors.add(:description, "may not contain \" characters") if /\"/.match(description) unless @predecessor_array.nil? # Only validate predecessors if they changed diff --git a/config/environment.rb b/config/environment.rb index 590161f4..d14d4087 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -61,6 +61,10 @@ Rails::Initializer.run do |config| # to enable "link":onenote://... or "link":blah://... hyperlinks config.action_view.sanitized_allowed_protocols = 'onenote', 'message' + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + # See Rails::Configuration for more options if ( SITE_CONFIG['authentication_schemes'].include? 'cas') #requires rubycas-client gem to be installed diff --git a/config/locales/en.yml b/config/locales/en.yml index 876954f4..81044f29 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -170,7 +170,7 @@ en: note_header: "Note {{id}}" note_link_title: "Show note {{id}}" delete_note_title: "Delete this note" - delete_confirmation: "Are you sure that you want to delete the note \'{{id}}\'?" + delete_confirmation: "Are you sure that you want to delete the note '{{id}}'?" edit_item_title: "Edit item" show_note_title: "Show note" deleted_note: "Deleted note '{{id}}'" @@ -270,7 +270,7 @@ en: month_avg_created: "{{months}} Month Avg Created" month_avg_completed: "{{months}} Month Avg Completed" click_to_update_actions: "Click on a bar in the chart to update the actions below." - click_to_return: "Click {{here}} to return to the statistics page." + click_to_return: "Click {{link}} to return to the statistics page." click_to_return_link: "here" click_to_show_actions_from_week: "Click {{link}} to show the actions from week {{week}} and further." running_time_all: "Current running time of all incomplete actions" @@ -431,7 +431,7 @@ en: total_projects: "Total projects" total_notes: "Total notes" destroy_user: "Destroy user" - destroy_confirmation: "Warning: this will delete user \'{{login}}\', all their actions, contexts, project and notes. Are you sure that you want to continue?" + destroy_confirmation: "Warning: this will delete user '{{login}}', all their actions, contexts, project and notes. Are you sure that you want to continue?" signup_new_user: "Signup new user" manage_users: "Manage users" total_users_count: "You have a total of {{count}} users" @@ -442,4 +442,4 @@ en: confirm_password: "Confirm password" signup: "Signup" errors: - user_unauthorized: "Only administrative users are allowed access to this function." + user_unauthorized: "401 Unauthorized: Only administrative users are allowed access to this function." diff --git a/features/logging_in.feature b/features/logging_in.feature index 3c742423..fa02ccf0 100644 --- a/features/logging_in.feature +++ b/features/logging_in.feature @@ -21,6 +21,7 @@ Feature: Existing user logging in | admin | secret | redirected to the home page | Login successful | | admin | wrong | on the login page | Login unsuccessful | + @wip Scenario Outline: Unauthorized users cannot access Tracks and need to log in first Given there exists a project called "top secret" for user "testuser" And there exists a context called "@secret location" for user "testuser" diff --git a/features/step_definitions/context_steps.rb b/features/step_definitions/context_steps.rb index 90f24a21..d47a7b06 100644 --- a/features/step_definitions/context_steps.rb +++ b/features/step_definitions/context_steps.rb @@ -49,7 +49,7 @@ When /^I delete the context "([^\"]*)"$/ do |context_name| context = @current_user.contexts.find_by_name(context_name) context.should_not be_nil click_link "delete_context_#{context.id}" - selenium.get_confirmation.should == "Are you sure that you want to delete the context '#{context_name}'? Be aware that this will also delete all actions in this context!" + selenium.get_confirmation.should == "Are you sure that you want to delete the context '#{context_name}'? Be aware that this will also delete all (repeating) actions in this context!" wait_for do !selenium.is_element_present("delete_context_#{context.id}") end diff --git a/test/functional/login_controller_test.rb b/test/functional/login_controller_test.rb index 051bb744..ecff40ff 100644 --- a/test/functional/login_controller_test.rb +++ b/test/functional/login_controller_test.rb @@ -66,14 +66,14 @@ class LoginControllerTest < ActionController::TestCase def test_login_bad_password post :login, {:user_login => 'jane', :user_password => 'wrong', :user_noexpiry => 'on'} assert(!@response.has_session_object?(:user)) - assert_equal "Login unsuccessful", flash[:warning] + assert_equal "Login unsuccessful.", flash[:warning] assert_response :success end def test_login_bad_login post :login, {:user_login => 'blah', :user_password => 'sesame', :user_noexpiry => 'on'} assert(!@response.has_session_object?(:user)) - assert_equal "Login unsuccessful", flash[:warning] + assert_equal "Login unsuccessful.", flash[:warning] assert_response :success end