From badelatng at gmail.com Mon Feb 2 11:03:16 2009 From: badelatng at gmail.com (Ben Delat) Date: Mon, 2 Feb 2009 17:03:16 +0100 Subject: [Rails I18n] how to glob with international or unicode file names? In-Reply-To: <7bdadc299f8143e9eb55a283307a44cc@ruby-forum.com> References: <7bdadc299f8143e9eb55a283307a44cc@ruby-forum.com> Message-ID: <9d4a668ff04407f5986eee3102e22851@ruby-forum.com> I know this is an old post, but I was wondering if there is a way to do this? I've been trying to use Ruby to do more of my scripting, but I have to keep switching back to python because I can't find a way to open files that use unicode characters in their name. I've tried Ruby 1.9 which I thought would deal with this, but it doesn't seem to work. Am I missing something? Any help is appreciated. SpringFlowers AutumnMoon wrote: > > with the Dir[" path "] > or Dir.glob > > is it possible to glob the filenames with unicode or international > characters in it? Right now it is returning ????????.mp3 > > to test it, you can grab some international characters at > > http://news.google.com/news?ned=hk -- Posted via http://www.ruby-forum.com/. From dan.bystrom at gmail.com Fri Feb 6 10:09:30 2009 From: dan.bystrom at gmail.com (=?utf-8?Q?Dan_Bystr=c3=b6m?=) Date: Fri, 6 Feb 2009 16:09:30 +0100 Subject: [Rails I18n] Posted form fields becomes [Binary Data] insted of strings Message-ID: Hi every one, I'm having problems with my Rails forms. When I submit a form that holds strings containing letters like ?,? or ? then the strings in the params variable are converted into [Binary Data]. Does anyone know why this happens? Thanks -Dan -- Posted via http://www.ruby-forum.com/. From dan.bystrom at gmail.com Sat Feb 7 09:21:07 2009 From: dan.bystrom at gmail.com (=?utf-8?Q?Dan_Bystr=c3=b6m?=) Date: Sat, 7 Feb 2009 15:21:07 +0100 Subject: [Rails I18n] Posted form fields becomes [Binary Data] insted of strings In-Reply-To: References: Message-ID: <7a8023d0cc4b06607b77f96d875debc7@ruby-forum.com> I figured out why my params are populated with [Binary Data]. Letters like ?,?, and ? are mutibyte charaters in the UTF8 format. In Rails 2.2.2 UTF8 is a default setting and since I use Eclipse/Aptana Studio, my params (containing ?,?,?) are displayed as [Binary Data] when I debug. -- Posted via http://www.ruby-forum.com/. From preethi1.s at tcs.com Mon Feb 9 06:34:22 2009 From: preethi1.s at tcs.com (Preethi Sivakumar) Date: Mon, 9 Feb 2009 12:34:22 +0100 Subject: [Rails I18n] problem in before_filter Message-ID: <1ce1d22a059c2cdca6d04fc9f0599750@ruby-forum.com> Hi, I've a session data that is generated when a user logs in. I'm trying to access that session data, in before_filter, in a different controller for passing parameter to the before_filter function. before_filter :only => [:index] do |obj| user = session[:user] has_permission_in_any(user.id,component_id,permission_id,user.communities) end But i'm not able to do that. What might be the reason? One more thing, I'm not able to call params[],redirect,or anything inside before_filter. Could anyone help? Thanks -- Posted via http://www.ruby-forum.com/. From jeba.momin at gmail.com Fri Feb 13 04:24:34 2009 From: jeba.momin at gmail.com (Jeba Momin) Date: Fri, 13 Feb 2009 10:24:34 +0100 Subject: [Rails I18n] i18n error with Rails 2.2.2 Message-ID: <6e714a99bc6c0fa6a13db783a7752fac@ruby-forum.com> 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 vetrivel.bksys at gmail.com Sat Feb 14 01:35:35 2009 From: vetrivel.bksys at gmail.com (Vetrivel Vetrivel) Date: Sat, 14 Feb 2009 07:35:35 +0100 Subject: [Rails I18n] parms variable Message-ID: <173894a014fac49da9b1523629184538@ruby-forum.com> I have doutes on params variable in rails. How to convert params to hash in rails. -- Posted via http://www.ruby-forum.com/. From jeba.momin at gmail.com Tue Feb 17 07:24:31 2009 From: jeba.momin at gmail.com (Jeba Momin) Date: Tue, 17 Feb 2009 13:24:31 +0100 Subject: [Rails I18n] localizing images... Message-ID: <8ba62d088f84f2a357e8d4baf8b97c6c@ruby-forum.com> 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... -- Posted via http://www.ruby-forum.com/. From alex.r at askit.org Fri Feb 20 19:08:06 2009 From: alex.r at askit.org (Alex Fortuna) Date: Sat, 21 Feb 2009 01:08:06 +0100 Subject: [Rails I18n] Guides on ActiveRecord error I18n seem to be WRONG Message-ID: <9aa4e11d25e6ba03b411a5b471e6ecaa@ruby-forum.com> Hi everyone. I was trying to customize AR validation error messages and came across this kind of message lookup order, which EVERY I18n guide in existence seems to be giving: ~~~ activerecord.errors.messages.models.user.attributes.name.blank activerecord.errors.messages.models.user.blank activerecord.errors.messages.blank ~~~ I tried to follow that, but, to my surprise, only least-detailed variant worked: "activerecord.errors.messages.blank". After a bit of research I've found out that lookup paths for Rails 2.2.2 are different from what's stated above. I.e. the ACTUAL paths being used are: ~~~ activerecord.errors.models.user.attributes.name.blank activerecord.errors.models.user.blank activerecord.errors.messages.blank ~~~ My test localization yaml is (model name is 'script'): ~~~ en: activerecord: errors: messages: blank: I'm errors.messages.blank models: script: # As documented, doesn't work. blank: I'm errors.messages.models.script.blank attributes: name: # As documented, doesn't work. blank: I'm errors.messages.models.script.attributes.name.blank models: script: # Not as documented, but it works. blank: I'm errors.MODELS.script.blank attributes: name: # Not as documented, but it works. blank: I'm errors.MODELS.script.attributes.name.blank ~~~ That kind of discrepancy in I18n guides seems rather serious to me, so I'm asking everyone who's in contact with guide authors or wikis to fix AR message lookup paths in documentation. If that's a confusion or version mismatch on my side, please correct me. I'm using Rails 2.2.2. Here are some guide links that seem to be WRONG: http://guides.rails.info/i18n.html http://rails-i18n.org/wiki/pages/i18n-rails-guide (and more, just search for 'activerecord.errors.messages.models.user') This page is RIGHT on lookup order: http://api.rubyonrails.org/classes/ActiveRecord/Errors.html Alex -- Posted via http://www.ruby-forum.com/. From rich.pav at gmail.com Mon Feb 23 03:11:58 2009 From: rich.pav at gmail.com (Rich Pav) Date: Mon, 23 Feb 2009 09:11:58 +0100 Subject: [Rails I18n] Trying to do simple model I18n, not succeeding. Message-ID: <71f4f954f78c5fbabf0689fada0e3d26@ruby-forum.com> Basically, all my tables look like this: create_table "countries", :force => true do |t| t.string "name_en" t.string "name_ja" end If the locale is set to 'en', I want Country.name to return Country.name_en. Is there a way to do this? Rich -- Posted via http://www.ruby-forum.com/. From skateinmars at skateinmars.net Mon Feb 23 10:20:17 2009 From: skateinmars at skateinmars.net (Jean-Philippe Moal) Date: Mon, 23 Feb 2009 16:20:17 +0100 Subject: [Rails I18n] Trying to do simple model I18n, not succeeding. In-Reply-To: <71f4f954f78c5fbabf0689fada0e3d26@ruby-forum.com> References: <71f4f954f78c5fbabf0689fada0e3d26@ruby-forum.com> Message-ID: <49A2BEB1.2070903@skateinmars.net> Rich Pav a ?crit : > Basically, all my tables look like this: > > create_table "countries", :force => true do |t| > t.string "name_en" > t.string "name_ja" > end > > If the locale is set to 'en', I want Country.name to return > Country.name_en. Is there a way to do this? > You are looking for the great translatable_columns plugin by Iain : http://github.com/iain/translatable_columns/tree/master From lurker2006 at gmail.com Wed Feb 25 06:14:25 2009 From: lurker2006 at gmail.com (Lurker2006@gmail.com Ann) Date: Wed, 25 Feb 2009 12:14: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: <5a83930288363c4e7e243c38693dfd30@ruby-forum.com> Hi,there are many computer ebooks free download. www.51cnnet.net such as:c++,csharp,adobe,ajax,asp.net,head-first,java,linux,my sql,oracle,perl,ruby,rails,python,acess,visual basic -- Posted via http://www.ruby-forum.com/. From lurker2006 at gmail.com Wed Feb 25 06:15:36 2009 From: lurker2006 at gmail.com (Lurker2006@gmail.com Ann) Date: Wed, 25 Feb 2009 12:15:36 +0100 Subject: [Rails I18n] computer ebooks free download--rails Message-ID: <37bfa86ff9e040e9722c58a03c4dc4c3@ruby-forum.com> Hi,there are many computer ebooks free download. www.51cnnet.net such as:c++,csharp,adobe,ajax,asp.net,head-first,java,linux,my sql,oracle,perl,ruby,rails,python,acess,visual basic -- Posted via http://www.ruby-forum.com/. From preethi1.s at tcs.com Fri Feb 27 09:55:19 2009 From: preethi1.s at tcs.com (Preethi Sivakumar) Date: Fri, 27 Feb 2009 15:55:19 +0100 Subject: [Rails I18n] Polymorphic associations has_many :through Message-ID: Hi, I'm facing an issue in polymorphic associations when i try to to :through relationship. I've three models:profile,gbluser,community profile.rb ------------- belongs_to :node ,:polymorphic => true belongs_to :community,:class_name => "community", :foreign_key => "node_id", :conditions => "node_type = 'community'" belongs_to :gblorganization,:class_name => "gblorganization", :foreign_key => "node_id", :conditions => "node_type = 'gblorganization'" has_and_belongs_to_many :gblusers Vcgbluser.rb ------------ has_many :communities,,:through=>:profiles,:conditions => "profiles.node_type = 'Community'",:source=>:community Vccommunity.rb -------------- has_many :gblusers ,:class_name =>"gbluser",:through=>:profiles,:conditions => "profiles.node_type = 'Community'",:source=>:community I'm trying to implement has_many :through relationship between community and users. user has_many communities through profiles and communities has_many users through profiles When i'm trying to do @user.communities, the search is made not on the mapping table between user and profiles but on the profile table itself. Rails is searching for user_id in profiles table but i've has_and_belongs_to_many between profile and user. How to solve this problem? Am I wrong somewhere. Please guide me. Thanks -- Posted via http://www.ruby-forum.com/. From preethi1.s at tcs.com Sat Feb 28 01:20:46 2009 From: preethi1.s at tcs.com (Preethi Sivakumar) Date: Sat, 28 Feb 2009 07:20:46 +0100 Subject: [Rails I18n] has_many :through, expects "through" model to be belongs_to Message-ID: Hi, I'm using has_many and through relationship between two models Profile and User Profile.rb ----------- has_and_belongs_to_many :users belongs_to :community User.rb ------- has_and_belongs_to_many :profiles has_many :communities, :through=>profiles When i try to do @user.communities, Rails is searching for foreign key of user in profile table, whereas profile and user have habtm relationship. How to solve this problem? Its urgent. please help -- Posted via http://www.ruby-forum.com/.