Cześć.
Wersja Rails 2.3.4
----------- Podczas odpalania testu funkcjonalnego dostaję prosty komunikat: --------------
Exception: translation missing: pl, activerecord, errors, models, user,
attributes, email, email_short
app/views/users/new.pl.html.erb:3
1: <h1>Rejestracja nowego użytkownika</h1>
2:
3: <%= error_messages_for :user %>
4: <% form_for :user, :url => users_path do |f| -%>
5:
6: <p><label for="login">Nazwa użytkownika
<%=req_field%>
app/views/users/new.pl.html.erb:3
app/controllers/users_controller.rb:59:in `create'
/test/functional/users_controller_test.rb:91:in `create_user'
/test/functional/users_controller_test.rb:53:in
test_should_require_email_on_signup' /test/functional/users_controller_test.rb:52:in
test_should_require_email_on_signup’
/usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in run' /usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in
each’
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in run' /usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in
run’
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in each' /usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in
run’
/usr/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in
run_suite' /home/wojtek/workspace_galileo/.metadata/.plugins/org.rubypeople.rdt.testunit/ruby/RemoteTestRunner.rb:117:in
start_mediator’
/home/wojtek/workspace_galileo/.metadata/.plugins/org.rubypeople.rdt.testunit/ruby/RemoteTestRunner.rb:62:in
`start’
/home/wojtek/workspace_galileo/.metadata/.plugins/org.rubypeople.rdt.testunit/ruby/RemoteTestRunner.rb:328
-------------- Model users.rb ma coś takiego ------------------
validates_length_of :email, :within => 3…100, :too_short =>
:email_short, :too_long => :email_long
--------- Struktura w pl.yml -------------
pl:
(…)
activerecord:
(…)
errors:
(…)
full_messages:
email_short: “Adres email jest za krótki, minimalna długość to {{count}} znaki”
email_long: “Adres email jest za długi, maksymalna długość to {{count}} znaków”
(…)
---------------- PYTANIE -------------------------
Jak uniknąć tego błędu przy testowaniu?
Jak aplikacja działa to full_messages są odczytywane i wszystko działa cacy.
Jeżeli jednak odpalam testy to tłumaczenia są szukane w jakiejś innej ścieżce (pl, activerecord, errors, models, user,
attributes, email, email_short), zamiast brane z full_messages (pl, activerecord, errors, full_messages) jak to się dzieje w przypadku normalnego działania aplikacji.
EDIT:
Już działa. To był problem z pluginem “translator”. Po odinstalowaniu już bangla.