Michal Burak | 17 Nov 14:47
Picon
Favicon

[Rails I18n] i18n full_message testing problem

Hi.

Rails version 2.3.4

----------- Running a functional test: --------------

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%></label><br/>

    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'
(Continue reading)

Dave Christiansen | 4 Nov 17:01

[Rails I18n] Error trying to translate a model name in a validation message

So far I've found internationalization with Rails to be a very pleasant experience. But I've run into trouble trying to translate model names and I need a little help.

Here's my fr.yml:
fr:
  activerecord:
    models:
      person: Personne
    attributes:
      last_name: "Nom de Famille"

Please forgive me if the French is bad - I'm just using it as a bootstrap example and it's not an official translation.

Last name is a required field and when I try to save I get this error:

translation data {:person=>"Personne"} can not be used with :count => 1

And here's some more information from Rails:

Extracted source (around line #28):

25:
26: <% content_for :title do %>
27: Edit Morbidity Event: <%= h(patient_name) %>
28: <% end %>
29:
30: <% content_for :tools_two do %>
31: <%= save_buttons( <at> event) %>

RAILS_ROOT: /home/david/trisano-ee/webapp

Application Trace | Framework Trace | Full Trace
/home/david/trisano-ee/webapp/vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:139:in `pluralize'
/home/david/trisano-ee/webapp/vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:40:in `translate'
/home/david/trisano-ee/webapp/vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb:165:in `t'
/home/david/trisano-ee/webapp/vendor/rails/actionpack/lib/action_view/helpers/active_record_helper.rb:197:in `error_messages_for'
/home/david/trisano-ee/webapp/vendor/rails/activesupport/lib/active_support/core_ext/object/misc.rb:78:in `with_options'
/home/david/trisano-ee/webapp/vendor/rails/actionpack/lib/action_view/helpers/active_record_helper.rb:192:in `error_messages_for'
/home/david/trisano-ee/webapp/app/views/morbidity_events/edit.html.erb:28:in `_run_erb_app47views47morbidity_events47edit46html46erb'
/home/david/trisano-ee/webapp/app/controllers/morbidity_events_controller.rb:141:in `update'
/home/david/trisano-ee/webapp/app/controllers/morbidity_events_controller.rb:123:in `update'

Anybody have any ideas what's going on?

Thanks in advance for the help.

Dave Christiansen
Senior Developer
Collaborative Software Initiative
503-545-5350 (CSI TriSano™ Support)
317-966-6154 (personal)
dave <at> csinitiative.com
Raffi Lipkin | 12 Oct 17:22
Picon

[Rails I18n] Telephone number validation and formatting

I'm working to build a telephone number validation and formatting
method.
I'm attaching an address_helper I use for this.
I'd like to get comments on it.
The method is based on extending the country model by adding 4 integer
attributes: tel_min, tel_max, tel_area_min and tel_area_max which are
the minimum and maximum number of digits of the telephone number in each
country and the minimum and maximum number of digits in the telephone
area code.
Please comment.
   Thanks,
      Raffi

Attachments:
http://www.ruby-forum.com/attachment/4139/address_helper.rb

--

-- 
Posted via http://www.ruby-forum.com/.
Preksha Patel | 3 Oct 09:29

[Rails I18n] error occurs while using savage beast plugin

Hi all,

I am using savage-beast plugin for forum..i have integrated code with my
application as given in readme file of savage-beast but now when i try
to run /script/server it gives me following error:

=> Booting Mongrel
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/module/aliasing.rb:33:in
`alias_method': undefined method `initialize_schema_information' for
module `ActiveRecord::ConnectionAdapters::SchemaStatements' (NameError)
  from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/module/aliasing.rb:33:in
`alias_method_chain'
  from
/var/www/citiplots_staging/vendor/plugins/temp/engines/lib/engines/rails_extensions/migrations.rb:131:in
`included'
  from
/var/www/citiplots_staging/vendor/plugins/temp/engines/lib/engines/rails_extensions/migrations.rb:131:in
`class_eval'
  from
/var/www/citiplots_staging/vendor/plugins/temp/engines/lib/engines/rails_extensions/migrations.rb:131:in
`included'
  from
/var/www/citiplots_staging/vendor/plugins/temp/engines/lib/engines/rails_extensions/migrations.rb:155:in
`include'
  from
/var/www/citiplots_staging/vendor/plugins/temp/engines/lib/engines/rails_extensions/migrations.rb:155
  from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
  from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
   ... 26 levels...
  from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/commands/server.rb:84
  from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
  from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
  from script/server:3

can any one please help me??

Thanks...
--

-- 
Posted via http://www.ruby-forum.com/.
Mitchell Gould | 2 Oct 13:02
Picon
Favicon

[Rails I18n] problems switching language after search form resuls

I have a form that allows the user to search for a manufacturer. It
works fine.

Now I am making the site in two languages French and English. I have the
basics of I18ln working as suggested in Agile Web Development book.

However for this particular case there is a problem. If the user chooses
to switch languages after the results come back the information is no
longer being sent as a request.post. In the controller I test for this
to make sure the information is coming from the form for security
reason.

  #takes the information entered on the search products box and returns
a list of possible matches.
  def search
    if request.post?
        @manufacturer_matches =
Manufacturer.find_all(params[:manufacturer])
        unless @manufacturer_matches[0]
          flash[:search] = t('manufacturers.search.flash', :manufacturer
=> params[:manufacturer]  )
        end
    end
  end

(find all is a method in the Manufacturers model.)

If i remove the request.post? potential hackers can get in and  the
parameters from the search box are not passed so the search returns
nothing.

Any ideas on the best practices to be
--

-- 
Posted via http://www.ruby-forum.com/.
Krzysztof Kotlarek | 23 Sep 00:10
Picon
Favicon

[Rails I18n] translatable columns and default language

Hello.
I use plugin translatable_column.
In admin panel user can add title in two languages(english and german)
In application I wish that if language is german and the title in german
isn`t added, rails should show title in english.
Is that possible ?

Best wishes
--

-- 
Posted via http://www.ruby-forum.com/.
Joao Silva | 25 Aug 21:17
Favicon

[Rails I18n] Problem with Iconv

Hello!

Here is my code:

require 'iconv'

result = Iconv.iconv('ascii//translit//IGNORE', 'utf-8', "zażółć gęślą
jaźń")
puts result.to_s.gsub(/[^\x00-\x7F]+/, '').gsub(/[^\w_ \-]+/i,   '')

Result (Mac OS X Leopard):

code/Rails/x[master]% port list | grep iconv
libticonv                      @1.1.0          math/libticonv
p5-text-iconv                  @1.4            perl/p5-text-iconv
libiconv                       @1.12           textproc/libiconv
code/Rails/x[master]% ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9]
code/Rails/x[master]% ruby test.rb
zazolc gesla jazn

This is what I want, but on my production (Ubuntu) machine i get much
different result:

rails <at> li103-32:~$ dpkg -l | grep iconv
ii  libtext-iconv-perl                1.7-1build1
converts between character sets in Perl
rails <at> li103-32:~$ ruby -v
ruby 1.8.6 (2008-08-11 patchlevel 287) [i686-linux]
Ruby Enterprise Edition 20090610
rails <at> li103-32:~$ ruby test.rb
za gl ja

What may causing this error? Maybe i need to install additional
packages?
--

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Railsi18n-discussion mailing list
Railsi18n-discussion <at> rubyforge.org
http://rubyforge.org/mailman/listinfo/railsi18n-discussion
Arthur Chan | 21 Aug 12:23

[Rails I18n] Translate Pages

Hi Guys,

PROBLEMS:

Our website supports both Chinese and English. We found that there are
many cases need different ways of translation.

a. For the views, we can translate words easily using the "_('hello
world')" functions.

b. For the static pages, we are using the:
/contact_us.html (for english)
/locale/zh_TW/contact_us.html (for chinese)

Nevertheless, there are two more cases I don't know how to translate way
are better:

c. Error page:
I don't know whether the "_()" function works

d. Server is down page:
when Rails is down, the lighttd may redirect to another static page.

METHODS:

How should we translate these four cases?

I am thinking whether we should load the English and then translate
using AJAX (or push the languages content to client and load it using
Javascript)?

Thanks!
Arthur
--

-- 
Posted via http://www.ruby-forum.com/.
Antoine Antoine | 11 Aug 10:26

[Rails I18n] Translating missing for I18n in models after upgrading gem

Hi everyone,

I deployed yesterday a new version of my website. For some features, I
had to upgrade rubygems to 1.3.1 version. Here is my gem env :
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.1
  - RUBY VERSION: 1.8.6 (2007-09-24 patchlevel 111) [i486-linux]
  - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: /usr/bin/ruby1.8
  - EXECUTABLE DIRECTORY: /usr/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /usr/lib/ruby/gems/1.8
     - /home/tableonline/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://gems.rubyforge.org/

Version of rails is 2.2.2

Path seems to be ok, as all my gems are there.
But since then (and i really don't understand the link), I18n ONLY IN
MODELS rb files is not working and I get the "Translation missing: en"
message for variables in those files. The weird stuff is that my locale
is fr (and seems to work as the rest of the website is correctly
translated).
Even more strange, in development environment (on my mac) everything is
working with the same versions.

I tried changing locale, upgrading en.yml with french values, nothing
changed...

Any clue of what is happening ?

Thanks a lot.
--

-- 
Posted via http://www.ruby-forum.com/.
Olaf S. | 5 Aug 19:30
Picon

[Rails I18n] Very strange problem with Gettext and Haml

Hi,

I'm on Rails 2.3.3 and using Haml 2.0.9 for my templates and
Gettext-Rails 2.0.4 for the translation. Haml works like a charm and
gettext is also working like it should.

But I cant get Gettext to parse Haml Files when using "rake updatepo". I
created a custom parser like this:

# lib/haml_parser.rb
require 'gettext_rails/tools'
require 'haml'
# Haml gettext parser
module HamlParser
  module_function

  def target?(file)
    File.extname(file) == ".haml"
  end

  def parse(file, ary = [])
    haml = Haml::Engine.new(IO.readlines(file).join)
    code = haml.precompiled.split(/$/)
    GetText::RubyParser.parse_lines(file, code, ary)
  end
end

GetText::RGetText.add_parser(HamlParser)

My Rakefile looks like this:

# Rakefile
require(File.join(File.dirname(__FILE__), 'config', 'boot'))

require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'

require 'tasks/rails'

desc "Create mo-files for L10n"
task :makemo do
  require 'gettext_rails/tools'
  GetText.create_mofiles(true)  #(true, "po", "locale")
end

desc "Update pot/po files to match new version."
task :updatepo do
  require 'gettext_rails/tools'
  require 'haml_parser'
  MY_APP_TEXT_DOMAIN = "APP"
  MY_APP_VERSION     = "APP 1.1.0"
  GetText.update_pofiles(MY_APP_TEXT_DOMAIN,
Dir.glob("{app,lib}/**/*.{rb,rhtml,html.erb,haml,html.haml,rjs}"),
                         MY_APP_VERSION)
end

This follows the known approach for parsing Haml files (
http://www.paulgillard.me.uk/2008/3/8/rails-haml-and-gettext ).

The problem: No MessageIds are recognized from my Haml files. I checked
with "puts" in the Haml-Parser if it tried the right files, could parse
them and so on. Everything seemed to be fine, it just recognize anything
and always returned only the already found msgids and for the Haml file
an empty Array.

The strange thing: When I enter this in my console, everything works:

$$ script/console
Loading development environment (Rails 2.3.3)
>> require 'gettext_rails/tools'
=> []
>> require 'haml'
=> []
>> file = "app/views/sessions/new.haml"
=> "app/views/sessions/new.haml"
>> haml = Haml::Engine.new(IO.readlines(file).join)
=> #<Haml::Engine:0x4254104 @tab_change=0, @block_opened=false, @inden
[...]
>> code = haml.precompiled.split(/$/)
=> [" content_for :head do;", "\nhaml_temp =  stylesheet_link [...]
>> GetText::RubyParser.parse_lines(file, code, [])
=> [["Login", "app/views/sessions/new.haml:4"], [...]

As you can see everything works here (I left out the long returns). I'm
kind of freaking out why this isn't the case in my Rake Task.

Anyone has an idea? You would really make me a happy Nerd!

Thanks!
--

-- 
Posted via http://www.ruby-forum.com/.
Mark Jones | 30 May 19:42
Picon

[Rails I18n] cars

hiii guys
When Ford introduced the Sync infotainment system in 2007, it was truly
revolutionary and available only in select vehicles. On May 26 Ford
delivered its 1 millionth Sync-equipped car, a 2010 Ford Fusion Hybrid,
in the Seattle area.

To celebrate topping the 1 million mark, Ford President and CEO Alan
Mulally personally handed the keys over to its new owner, who happens to
be Steve Ballmer, Microsoft's CEO. Ballmer purchased the hybrid sedan as
well as a new Ford Flex a few weeks earlier from a local dealership.

A joint effort between the automaker and Microsoft, Sync is essentially
a small PC that runs on a version of Windows built for the harsh
automotive environment. It allows a car's stock radio to seamlessly
interface with mobile phones and digital music players, such as an
iPhone or Microsoft Zune. It also lets the driver or passenger verbally
communicate with and control these devices using voice-activation
technology. And since the Sync system is software-based, expanding
capability is as easy as installing a new computer program. And it does
all of this for less than $400.

The Sync system has been a huge success with both the tech-savvy and
tech-challenged crowds, which is why it is now installed in more than 80
percent of Ford vehicles sold in North America.

Last year Sync added two new applications: Vehicle Health Report and 911
Assist. Ford's latest Sync application, Traffic, Directions and
Information, will be available for download this summer. It will provide
personalized traffic reports, driving directions and up-to-date
information, including business listings, news, sports scores and
weather.

Ford and Microsoft had a one-year exclusivity agreement, and while the
Sync system remains exclusive to Ford, Microsoft can now partner with
other car companies to expand the technology offering.

Perry Stern's automotive career began 19 years ago as an adviser at a
vehicle consulting firm. One of the original staff members of CarPoint,
Microsoft's automotive Web site that launched in 1995, he became editor
of the site in 2002, which is now known as MSN Autos. Stern has also
contributed to MSNBC and various MSN properties in Canada, Japan and
Europe.

In the market for a new car? MSN Autos is pleased to provide you with
information and services designed to save you time, money and hassle.
Click to research prices and specifications on any new car on the market
or get a free price quote through MSN Autos' New-Car Buying Service.

--------
fusion
--------
<a href="http://www.widecircles.com" rel="dofollow">link
building</a>--link building
--

-- 
Posted via http://www.ruby-forum.com/.

Gmane