From faivrem at gmail.com Sun Mar 1 18:14:20 2009 From: faivrem at gmail.com (Mickael Faivre-Macon) Date: Mon, 2 Mar 2009 00:14:20 +0100 Subject: [Rails I18n] Loading several locales files In-Reply-To: <51cc3943468b0c5c04bd9d51e5dbc09b@ruby-forum.com> References: <51cc3943468b0c5c04bd9d51e5dbc09b@ruby-forum.com> Message-ID: This is the solution, add this to your environment.rb. I18n.default_locale = 'en' LOCALES_DIRECTORY = "#{RAILS_ROOT}/config/locales" LOCALES_AVAILABLE = Dir["#{LOCALES_DIRECTORY}/*.{rb,yml}"].collect do |locale_file| I18n.load_path << locale_file File.basename(File.basename(locale_file, ".rb"), ".yml") end.uniq.sort -- Posted via http://www.ruby-forum.com/. From preethi1.s at tcs.com Wed Mar 4 04:52:20 2009 From: preethi1.s at tcs.com (Preethi Sivakumar) Date: Wed, 4 Mar 2009 10:52:20 +0100 Subject: [Rails I18n] creating list of values LOV Message-ID: <5e753daaf1afa668434da8b4212ec65f@ruby-forum.com> Hi, I want to select some users from 'n' number of user, where, right now I'm using textboxes which take search criteria and populating a list box. I want to replace the whole thing with an LOV(list of values) feature wherein I can have just a search button which will popup a window and take my search criteria in text box and populate the values in same window so that i can select from them and when i click on submit, the values selected must be selected for next operation. How can i achieve that? Is there any plugin? Any help is greatly appreciated Thanks. -- Posted via http://www.ruby-forum.com/. From pedrolito at lavache.com Mon Mar 9 12:20:42 2009 From: pedrolito at lavache.com (Fernando Perez) Date: Mon, 9 Mar 2009 17:20:42 +0100 Subject: [Rails I18n] Translate model name when validation fails Message-ID: Let's say I want to submit a user. Currently if the user submission fails, I get the name "user", but I would like to translate it into other languages. I can make the translation work for its attributes but not the model name itself. Thanks in advance. -- Posted via http://www.ruby-forum.com/. From mercedes6s at hotmail.com Fri Mar 13 09:05:42 2009 From: mercedes6s at hotmail.com (Bassel Samman) Date: Fri, 13 Mar 2009 14:05:42 +0100 Subject: [Rails I18n] Translate model name when validation fails In-Reply-To: References: Message-ID: If you want to translate data and not just static content, I highly recommend using Globalize2 as it has the best of both worlds. You can still use locale files for static content, but you can also use translation tables. I also wrote a small extension to it that I can share if you'd like that lets you do things like en_name and sp_name and so on to get the translated name you want. I tried it out for my last project, and I'm loving it. Thanks, Bassel http://www.imustrant.com Fernando Perez wrote: > Let's say I want to submit a user. Currently if the user submission > fails, I get the name "user", but I would like to translate it into > other languages. > > I can make the translation work for its attributes but not the model > name itself. > > Thanks in advance. -- Posted via http://www.ruby-forum.com/. From andringa at quicknet.nl Wed Mar 18 10:59:07 2009 From: andringa at quicknet.nl (Sjoerd Andringa) Date: Wed, 18 Mar 2009 15:59:07 +0100 Subject: [Rails I18n] Translate model name when validation fails In-Reply-To: References: Message-ID: <533965bdb5387ea6cd60d353822e0f5a@ruby-forum.com> Fernando Perez wrote: > Let's say I want to submit a user. Currently if the user submission > fails, I get the name "user", but I would like to translate it into > other languages. > > I can make the translation work for its attributes but not the model > name itself. > > Thanks in advance. You can translate model names in a similar way you translate its attributes:
en:
  activerecord:
    models:
      user: Gebruiker
    attributes:
      user:
        login: gebruikersnaam
Hope this works for you! -- Posted via http://www.ruby-forum.com/. From andringa at quicknet.nl Wed Mar 18 11:13:11 2009 From: andringa at quicknet.nl (Sjoerd Andringa) Date: Wed, 18 Mar 2009 16:13:11 +0100 Subject: [Rails I18n] Custom error messages Message-ID: I've been trying to have a translated custom error message for when the format of a user's email address is invalid. I'm running rails 2.2.2 and trying to save the translations to the key activerecord.errors.models.user.attributes.email.invalid doesn't work... it just uses to default message. Is this something of a later release? -- Posted via http://www.ruby-forum.com/. From andringa at quicknet.nl Wed Mar 18 11:15:12 2009 From: andringa at quicknet.nl (Sjoerd Andringa) Date: Wed, 18 Mar 2009 16:15:12 +0100 Subject: [Rails I18n] Custom error messages In-Reply-To: References: Message-ID: Sjoerd Andringa wrote: > I've been trying to have a translated custom error message for when the > format of a user's email address is invalid. > > I'm running rails 2.2.2 and trying to save the translations to the key > activerecord.errors.models.user.attributes.email.invalid doesn't work... > it just uses to default message. > > Is this something of a later release? This seems to be the problem: http://www.ruby-forum.com/topic/179273 -- Posted via http://www.ruby-forum.com/. From frantisek.psotka at matfyz.cz Wed Mar 18 15:48:36 2009 From: frantisek.psotka at matfyz.cz (Frantisek Psotka) Date: Wed, 18 Mar 2009 20:48:36 +0100 Subject: [Rails I18n] i18n error with Rails 2.2.2 In-Reply-To: <6e714a99bc6c0fa6a13db783a7752fac@ruby-forum.com> References: <6e714a99bc6c0fa6a13db783a7752fac@ruby-forum.com> Message-ID: <03f6c88364dbffac2b58342d7e5eff90@ruby-forum.com> hi i'have got same problem and adjusting en.yml have fixed it. the my issue was: en: means empty localization file, i have changed it to: en: foo: and now it seems it works... Jeba Momin wrote: > hi, > I'm using i18n with Rails 2.2.2 to internationalize my rails > application. > I've followed the steps as specified at: > http://www.railsrocket.com/articles/wp-content/uploads/i18n-your-rails-app-in-34-languages.pdf > > But ...I get the following error when I try to run it: > You have a nil object when you didn't expect it! > You might have expected an instance of Array. > The error occurred while evaluating nil.inject > 1: > 2:

<%= I18n.t :hello_world %>

> 3:
> 4:

<%= I18n.t :hello_everyone %>

> 5: > RAILS_ROOT: E:/i18n > Application Trace | Framework Trace | Full Trace > > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:208:in > `deep_symbolize_keys' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:199:in > `merge_translations' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:179:in > `load_file' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:179:in > `each' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:179:in > `load_file' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:13:in > `load_translations' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:13:in > `each' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:13:in > `load_translations' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:79:in > `init_translations' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:94:in > `lookup' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:33:in > `translate' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n.rb:160:in > `t' > app/views/main/index.rhtml:2 > > > > Can anyone please tell me..how can I correct this... > Thank You... -- Posted via http://www.ruby-forum.com/. From k5mmx at yahoo.com Wed Mar 18 19:06:43 2009 From: k5mmx at yahoo.com (Simone R.) Date: Thu, 19 Mar 2009 00:06:43 +0100 Subject: [Rails I18n] localizing images... In-Reply-To: <8ba62d088f84f2a357e8d4baf8b97c6c@ruby-forum.com> References: <8ba62d088f84f2a357e8d4baf8b97c6c@ruby-forum.com> Message-ID: <3bd9141747e1a1f7f0718671aadfb6d2@ruby-forum.com> Jeba Momin wrote: > Hi, > I'm using rails 2.2.2 and i18n for localization... > I want to know...how do I localize the text which are a part of > images..??? > Currently I'm offering English and German as the language options.. > I have made exact copies of all the images with german text... > How do I use these images...when locale=german???? > Do I use 'if' statement each time and use english/german images > accordingly??? > Or is there a better way???? > Thank You... I dont know ruby (i'm a newbie here) but generally I solve using a naming composition on images like locale+imagename.jpg or a better images/locale/imagename.jpg or better again and a fully "RUBY WAY" just watch this video http://content.newrelic.com/videos/01-ScalingRails-Page-Responsiveness.mp4 on that video is explained how to use Content Delivery Network for serving images and video from the right server (a germa server for germa users , a french server for french users and so on) -- Posted via http://www.ruby-forum.com/. From mr.ronald at gmx.de Fri Mar 20 12:33:25 2009 From: mr.ronald at gmx.de (Ronald Sacher) Date: Fri, 20 Mar 2009 17:33:25 +0100 Subject: [Rails I18n] Guides on ActiveRecord error I18n seem to be WRONG In-Reply-To: <9aa4e11d25e6ba03b411a5b471e6ecaa@ruby-forum.com> References: <9aa4e11d25e6ba03b411a5b471e6ecaa@ruby-forum.com> Message-ID: Thanks for pointing this out. Saved my day. -- Posted via http://www.ruby-forum.com/. From alex.r at askit.org Fri Mar 20 12:38:22 2009 From: alex.r at askit.org (Alex Fortuna) Date: Fri, 20 Mar 2009 17:38:22 +0100 Subject: [Rails I18n] Guides on ActiveRecord error I18n seem to be WRONG In-Reply-To: References: <9aa4e11d25e6ba03b411a5b471e6ecaa@ruby-forum.com> Message-ID: <2baf5bac24d3f0de8ec8403f83484475@ruby-forum.com> Mr. Ronald wrote: > Thanks for pointing this out. Saved my day. Guide at guides.rails.info has already been fixed by guide maintainer, Karel. -- Posted via http://www.ruby-forum.com/. From mr.ronald at gmx.de Fri Mar 20 12:51:30 2009 From: mr.ronald at gmx.de (Mr. Ronald) Date: Fri, 20 Mar 2009 17:51:30 +0100 Subject: [Rails I18n] Guides on ActiveRecord error I18n seem to be WRONG In-Reply-To: <2baf5bac24d3f0de8ec8403f83484475@ruby-forum.com> References: <9aa4e11d25e6ba03b411a5b471e6ecaa@ruby-forum.com> <2baf5bac24d3f0de8ec8403f83484475@ruby-forum.com> Message-ID: But isn't there still an error in http://rails-i18n.org/wiki/pages/i18n-rails-guide activerecord.errors.messages.models.user.attributes.name.blank which should be activerecord.errors.models.user.attributes.name.blank right? -- Posted via http://www.ruby-forum.com/. From pradeep.theindiainc at gmail.com Sat Mar 21 05:51:02 2009 From: pradeep.theindiainc at gmail.com (Pradeep Banewar) Date: Sat, 21 Mar 2009 10:51:02 +0100 Subject: [Rails I18n] Is free download software for dvd backup useful? Message-ID: I heard about free download software for dvd backup such as dvd shrink. But I want to that these are useful for user. -- Posted via http://www.ruby-forum.com/. From fxn at hashref.com Sat Mar 21 18:03:18 2009 From: fxn at hashref.com (Xavier Noria) Date: Sat, 21 Mar 2009 23:03:18 +0100 Subject: [Rails I18n] Guides on ActiveRecord error I18n seem to be WRONG In-Reply-To: References: <9aa4e11d25e6ba03b411a5b471e6ecaa@ruby-forum.com> <2baf5bac24d3f0de8ec8403f83484475@ruby-forum.com> Message-ID: <31a130740903211503w75e05dfdnfa3ca64513331d2c@mail.gmail.com> On Fri, Mar 20, 2009 at 5:51 PM, Mr. Ronald wrote: > But isn't there still an error in > http://rails-i18n.org/wiki/pages/i18n-rails-guide Yeah don't rely on that page, it is just draft. The i18n guide is at http://guides.rubyonrails.org/i18n.html. From gregory at websystemstudio.com Mon Mar 23 15:48:34 2009 From: gregory at websystemstudio.com (Gregory Tomei) Date: Mon, 23 Mar 2009 20:48:34 +0100 Subject: [Rails I18n] problem with running functional tests( ActionView::Template) In-Reply-To: References: Message-ID: <026e07dc64de8c002e04ded171a46469@ruby-forum.com> Kiran, I am experiencing this same problem. The methods I have defined in ApplicationHelper (app/helpers/application_help.rb) are not available in tests, although they do work in dev mode when I use the app via web browser. Did you find a solution for this? Thanks Kiran DP wrote: > Hi, > I am trying to run functional tests in my application but I am > getting following error when I am trying to the tests: > > > 1) Error: > test_profile_member_card_visitor_viewing_public(MembersControllerTest): > ActionView::TemplateError: undefined method `use_wrapper' for > #<#:0x8c201c0> > On line #1 of app/views/members/profile.rhtml > > 1: <% use_wrapper :standard -%> > 2: <% show :prototype %> > 3: <% show :scriptaculous %> > 4: <% show :lytebox %> > > E:/MyAptanaProject/Community_sprint_035 > Recent/app/views/members/profile.rhtml:1:in > `_run_rhtml_47app47views47members47profile46rhtml' [backtrace was here...] > members_controller_test.rb:320 > > I have a member controller with me, and for member > controller profile action I have a profile page which includes some view > helpers through the application helper.(There are some files included > from application helper.) > In above output the I have defined use_wrapper method in > one of the files included in the application helper. > I have tried to resolve the error by including all helpers > in test helper, but no luck. Please help. -- Posted via http://www.ruby-forum.com/. From coder at montx.com Wed Mar 25 06:24:34 2009 From: coder at montx.com (Raimon Fs) Date: Wed, 25 Mar 2009 11:24:34 +0100 Subject: [Rails I18n] locale currency only works for displaying numbers? Message-ID: Hello, Using a locale I can format the same number for displaying it: database: 1900.58 en layout: 1,900.58 cat layout: 1.900,58 this is ok .... but how I can do the reverse of it, when the user submits via form a number in it's locale format ? for example if the user enters in cat locale: 1900,58 the resulted number is 1900.00 currently I'm evaluating every field number and replacing commas by dots, but it's a pain to format/adjust everyplace there is a number coming from a form. I thought Rails I18n should handle this in a transparent manner ... or sure I'm missing the point here and maybe there's a function to do it ... thanks! r. -- Posted via http://www.ruby-forum.com/.