From sathya.kishore at lgcnsglobal.com Thu Aug 3 07:57:34 2006 From: sathya.kishore at lgcnsglobal.com (Sathya) Date: Thu, 3 Aug 2006 13:57:34 +0200 Subject: [Rails I18n] How to install Globalize behind a proxy Message-ID: Hello, Iam a newbie and i just wanna know how to install Globalize plugin from the command prompt when iam behind a proxy server..in the case of a gem install therez an option of -p http://proxyip:port , similarly is there any command to install globalize or for that matter any plugin if iam shielded by a proxy? Thanks in advance Sathya -- Posted via http://www.ruby-forum.com/. From andre at boaideia.inf.br Thu Aug 3 08:15:41 2006 From: andre at boaideia.inf.br (=?ISO-8859-1?Q?Andr=E9_Camargo?=) Date: Thu, 3 Aug 2006 09:15:41 -0300 Subject: [Rails I18n] How to install Globalize behind a proxy In-Reply-To: References: Message-ID: <884a25770608030515m212e7735v5a78f3fbee47d7f4@mail.gmail.com> hi! if available, you can download a plugin's packed version (zip or tar.gz file) throught http and unpack it into RAILS_ROOT/vendor/plugin directory. restart your webserver and it's ready to go. happy hacking 2006/8/3, Sathya : > Hello, > > Iam a newbie and i just wanna know how to install Globalize plugin from > the command prompt when iam behind a proxy server..in the case of a gem > install therez an option of -p http://proxyip:port , similarly is there > any command to install globalize or for that matter any plugin if iam > shielded by a proxy? > > Thanks in advance > > Sathya > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Railsi18n-discussion mailing list > Railsi18n-discussion at rubyforge.org > http://rubyforge.org/mailman/listinfo/railsi18n-discussion > -- andr? ribeiro camargo propriet?rio boa id?ia software livre :: boaideia.inf.br --- SOFTWARE LIVRE socialmente justo econ?micamente vi?vel tecnologicamente sustent?vel From sathya.kishore at lgcnsglobal.com Thu Aug 3 09:08:30 2006 From: sathya.kishore at lgcnsglobal.com (Sathya) Date: Thu, 3 Aug 2006 15:08:30 +0200 Subject: [Rails I18n] How to install Globalize behind a proxy In-Reply-To: <884a25770608030515m212e7735v5a78f3fbee47d7f4@mail.gmail.com> References: <884a25770608030515m212e7735v5a78f3fbee47d7f4@mail.gmail.com> Message-ID: <1b3e0b67ab862b1b3b0e0639b9eb6c62@ruby-forum.com> Hi Andre, Thanq for ur prompt reply,but i dont understand how to download this Globalize plugin directly as a zip file , coz the link they provide in thier home page ie http://www.globalize-rails.org/wiki/pages/example is http://svn.globalize-rails.org/svn/globalize/globalize/trunk, this link directs to a web page containing some links, but i dont understand how can i download any file from these links.. Please help Sathya Andr? Camargo wrote: > hi! > > if available, you can download a plugin's packed version (zip or > tar.gz file) throught http and unpack it into RAILS_ROOT/vendor/plugin > directory. restart your webserver and it's ready to go. > > happy hacking > > 2006/8/3, Sathya : >> Sathya >> >> -- >> Posted via http://www.ruby-forum.com/. >> _______________________________________________ >> Railsi18n-discussion mailing list >> Railsi18n-discussion at rubyforge.org >> http://rubyforge.org/mailman/listinfo/railsi18n-discussion >> > > > -- > andr? ribeiro camargo > propriet?rio > boa id?ia software livre :: boaideia.inf.br > --- > SOFTWARE LIVRE > socialmente justo > econ?micamente vi?vel > tecnologicamente sustent?vel -- Posted via http://www.ruby-forum.com/. From sathya.kishore at lgcnsglobal.com Thu Aug 3 10:14:56 2006 From: sathya.kishore at lgcnsglobal.com (Sathya) Date: Thu, 3 Aug 2006 16:14:56 +0200 Subject: [Rails I18n] What is the next step after downloading Gloc Message-ID: <4a3465e88a079add93ad460adcf66bec@ruby-forum.com> Hi, I just downloaded the Gloc plugin and extracted it in to the vendors/plugins folder but what is the next step? Is there any documentation or tutorial available as an example of how to check internationalization support with this plugin? Thanks in advance\ Sathya -- Posted via http://www.ruby-forum.com/. From japgolly at gmail.com Thu Aug 3 21:23:08 2006 From: japgolly at gmail.com (David Barri) Date: Fri, 4 Aug 2006 11:23:08 +1000 Subject: [Rails I18n] What is the next step after downloading Gloc In-Reply-To: <4a3465e88a079add93ad460adcf66bec@ruby-forum.com> References: <4a3465e88a079add93ad460adcf66bec@ruby-forum.com> Message-ID: Hi. I'm busy as lately and I've had no time to work on GLoc or make any tutorials. For now though have a look at the README, that should be enough :) Else try to find someone else in the community that uses it and maybe ask to look at their code or something. Sorry that's not much help. Golly On 04/08/06, Sathya wrote: > Hi, > > I just downloaded the Gloc plugin and extracted it in to the > vendors/plugins folder but what is the next step? Is there any > documentation or tutorial available as an example of how to check > internationalization support with this plugin? > > Thanks in advance\ > > Sathya > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Railsi18n-discussion mailing list > Railsi18n-discussion at rubyforge.org > http://rubyforge.org/mailman/listinfo/railsi18n-discussion > From harish4groups at gmail.com Fri Aug 4 03:31:14 2006 From: harish4groups at gmail.com (Naga harish Kanegolla) Date: Fri, 4 Aug 2006 09:31:14 +0200 Subject: [Rails I18n] Rails Application Failed to start Properly Message-ID: <414d11c3a6e8e6dbb9839f5ea075a345@ruby-forum.com> Hi all, I have created a new application and Its working fine in my local system and also in the server. But after some days I have added one new controller(projects) in the admin module so that the admin can manage the projects. Its also working good. All the things are working in the application but in the admin module, admin should see the list of users and if the admin click on the particular user he should get the details of the user. But if i click on the user its giving an error "Rails Application Failed to start properly". But this worked two days back also. I'm getting till the list of users and not getting the details of the user. Can u please tell me wats the problem behind it?? Thanks ~Harish -- Posted via http://www.ruby-forum.com/. From bonnee at csgsolar.com.au Fri Aug 4 02:27:32 2006 From: bonnee at csgsolar.com.au (Bonne Eggleston) Date: Fri, 4 Aug 2006 16:27:32 +1000 Subject: [Rails I18n] Functional testing Message-ID: <200608041627.32392.bonnee@csgsolar.com.au> Hi there, I'm implementing the Globalize plugin on my application, and so far it's working quite well. One problem I'm having is that I can't do any functional tests. It appears as though the locale is not set for the tests, and an error is thrown by the find_every function where it tries to get the language code. This problem is not seen outside of testing. is this common? Can anyone else reproduce it? Is there a fix? I'm using Rails 1.1 and the 1.1 branch of Globalize. Also the include_translated option for the find method doesn't appear to work. Is there some trick to use it? It always throws an invalid option error. Regards, Bonne Eggeleston. From bonne at ixum.net Fri Aug 4 03:36:23 2006 From: bonne at ixum.net (Bonne Eggleston) Date: Fri, 4 Aug 2006 17:36:23 +1000 Subject: [Rails I18n] Rails Application Failed to start Properly In-Reply-To: <414d11c3a6e8e6dbb9839f5ea075a345@ruby-forum.com> References: <414d11c3a6e8e6dbb9839f5ea075a345@ruby-forum.com> Message-ID: <200608041736.23497.bonne@ixum.net> Hi Harish You need to switch to development mode, so that you can see the error. Or otherwise check your log file to see where it's crashing. Basically it could be anything from a syntax error to a missing row in your database, without more information it's impossible to tell Bonne On Friday 04 August 2006 17:31, Naga harish Kanegolla wrote: > Hi all, > > I have created a new application and Its working fine in my local > system and also in the server. > > But after some days I have added one new controller(projects) in the > admin module so that the admin can manage the projects. Its also working > good. > > All the things are working in the application but in the admin module, > admin should see the list of users and if the admin click on the > particular user he should get the details of the user. But if i click on > the user its giving an error > > "Rails Application Failed to start properly". But this worked two days > back also. > > I'm getting till the list of users and not getting the details of the > user. > > Can u please tell me wats the problem behind it?? > > Thanks > ~Harish From zarni.worgl at gmail.com Sat Aug 5 07:47:22 2006 From: zarni.worgl at gmail.com (Zarni Worgl) Date: Sat, 5 Aug 2006 13:47:22 +0200 Subject: [Rails I18n] Globalizing Typo 4.0.0 - S.O.S. Help needed! Message-ID: Hello friendly rubyists! This is my first post, so bare with me :) I managed to globalize Typo 4.0.0 - the static content. I made a Translations editor menu in the admin, and it works fine for all static content. Now I am trying to globalize Article/Content. I have done this: class Article < Content include TypoGuid content_fields :body, :extended translates :body, :extended ... Now I get this error: => Booting WEBrick... ./script/../config/../vendor/rails/activerecord/lib/active_record/base.rb:1129:in `method_missing': undefined method `translates' for Article:Class (NoMethodError) from script/../config/../app/models/article.rb:8 from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:140:in `load' from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:56:in `require_or_load' from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:30:in `depend_on' from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:85:in `require_dependency' from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:98:in `const_missing' from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:131:in `const_missing' from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:133:in `const_missing' ... 20 levels... from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require' from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:147:in `require' from ./script/../config/../vendor/rails/railties/lib/commands/server.rb:30 from script/server:3 I have very little knowledge about meta programming in ruby, but I think it has got something to do with the way the Article ActiveRecord object is extending the base Content class. I tried putting the translates method in the Categories class which does not extend the Content class and it works fine! Can anyone help me solve this issue, it is very important!? Please help me, I am almost cluless about this problem. Regards, Zarni -- Posted via http://www.ruby-forum.com/. From patrick.schnegg at gmail.com Sun Aug 6 20:11:03 2006 From: patrick.schnegg at gmail.com (Patrick Schnegg) Date: Mon, 7 Aug 2006 02:11:03 +0200 Subject: [Rails I18n] Functional testing In-Reply-To: <200608041627.32392.bonnee@csgsolar.com.au> References: <200608041627.32392.bonnee@csgsolar.com.au> Message-ID: <8e385f3dbe7c99827197022f01707693@ruby-forum.com> I am having about the same issue. I'm using Globalize with a switch in the url like ":locale/:controller/..." and it breaks functional tests, spitting out "No url can be generated for the hash"-routing errors. I've tried to get around this by setting up a redirect. This would even come in handy for other reasons. What I tried to achieve is that urls without the locale like "www.url.com/mycontroller/" would get redirected to "www.url.com/en/mycontroller/", with "en" here being the default locale. Does anyone know how to get this done? Greetings Patrick -- Posted via http://www.ruby-forum.com/. From sathya.kishore at lgcnsglobal.com Mon Aug 7 01:44:08 2006 From: sathya.kishore at lgcnsglobal.com (Sathya) Date: Mon, 7 Aug 2006 07:44:08 +0200 Subject: [Rails I18n] Does Globalize supports properties files Message-ID: <138081f7b68801905c69d316d257444e@ruby-forum.com> Hi, i just wanna know how does Globalize work? Is it capable of reading data from properties files as in Java? If so where should i define these properties files? I have a scenario where there are some labels in a web page in the default english such as :user code 2: user name 3: user company and now user has an option to chose a language of his choice which he selects from a dropdown provided Now how can i display these labels in the chosen user language? If user opted for Spanish, how can i display these labels in spanish immediately? Thanks in Advance Sathya -- Posted via http://www.ruby-forum.com/. From thomas.baustert at b-simple.de Sat Aug 5 08:34:32 2006 From: thomas.baustert at b-simple.de (Thomas Baustert) Date: Sat, 5 Aug 2006 14:34:32 +0200 Subject: [Rails I18n] Globalizing Typo 4.0.0 - S.O.S. Help needed! In-Reply-To: References: Message-ID: <361C70E3-DD87-4412-8E80-06E63DAEBC14@b-simple.de> Hi Zarni, I'm not sure, but is Content a model based on ActiveRecord::Base? If not, than Article is not a model (any more) and does not define translates. The content_fields seems to a method from TypoGuid. You include the module an therefore this method exists. Am 05.08.2006 um 13:47 schrieb Zarni Worgl: > Hello friendly rubyists! This is my first post, so bare with me :) > > I managed to globalize Typo 4.0.0 - the static content. I made a > Translations editor menu in the admin, and it works fine for all > static > content. > > Now I am trying to globalize Article/Content. > > I have done this: > > class Article < Content > include TypoGuid > > content_fields :body, :extended > > translates :body, :extended > > ... > > Now I get this error: > > > => Booting WEBrick... > ./script/../config/../vendor/rails/activerecord/lib/active_record/ > base.rb:1129:in > `method_missing': undefined method `translates' for Article:Class > (NoMethodError) > from script/../config/../app/models/article.rb:8 > from > ./script/../config/../vendor/rails/activesupport/lib/active_support/ > dependencies.rb:140:in > `load' > from > ./script/../config/../vendor/rails/activesupport/lib/active_support/ > dependencies.rb:56:in > `require_or_load' > from > ./script/../config/../vendor/rails/activesupport/lib/active_support/ > dependencies.rb:30:in > `depend_on' > from > ./script/../config/../vendor/rails/activesupport/lib/active_support/ > dependencies.rb:85:in > `require_dependency' > from > ./script/../config/../vendor/rails/activesupport/lib/active_support/ > dependencies.rb:98:in > `const_missing' > from > ./script/../config/../vendor/rails/activesupport/lib/active_support/ > dependencies.rb:131:in > `const_missing' > from > ./script/../config/../vendor/rails/activesupport/lib/active_support/ > dependencies.rb:133:in > `const_missing' > ... 20 levels... > from > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in > `require' > from > ./script/../config/../vendor/rails/activesupport/lib/active_support/ > dependencies.rb:147:in > `require' > from > ./script/../config/../vendor/rails/railties/lib/commands/server.rb:30 > from script/server:3 > > > > I have very little knowledge about meta programming in ruby, but I > think > it has got something to do with the way the Article ActiveRecord > object > is extending the base Content class. > > I tried putting the translates method in the Categories class which > does > not extend the Content class and it works fine! > > Can anyone help me solve this issue, it is very important!? Please > help > me, I am almost cluless about this problem. > > Regards, > Zarni > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Railsi18n-discussion mailing list > Railsi18n-discussion at rubyforge.org > http://rubyforge.org/mailman/listinfo/railsi18n-discussion > --- Thomas Baustert - Freiberuflicher Softwarecoach fon: +49(40)411 622 35 mobil: +49(173)23 911 43 fax: +49(40)411 622 36 thomas.baustert(at)b-simple.de From thomas.baustert at b-simple.de Mon Aug 7 12:09:48 2006 From: thomas.baustert at b-simple.de (Thomas Baustert) Date: Mon, 7 Aug 2006 18:09:48 +0200 Subject: [Rails I18n] Globalize and more than one dynamic value Message-ID: Hi all, consider the case you have more than one dynamic value for a text. You can write: <%= There are %d horses / 3 %> but, what if: <%= There are %d horses on the %s / [3, "moon"] %> The following idea won't work: <%= (There are %d horses on the %s / 3) / "moon" %> since Globalize would insert the two strings "There are %d horses on the %s" "There are 3 horses on the %s" in the database and one more for each new value :). My idea is to patch Globalize to accept an array of value. Does anyone had the same problem? Just wanna know what you think. Thanx in advance. Thomas --- Thomas Baustert - Freiberuflicher Softwarecoach fon: +49(40)411 622 35 mobil: +49(173)23 911 43 fax: +49(40)411 622 36 thomas.baustert(at)b-simple.de From anthony at cutthecosta.com Mon Aug 7 13:29:51 2006 From: anthony at cutthecosta.com (Anthony) Date: Mon, 7 Aug 2006 19:29:51 +0200 Subject: [Rails I18n] Globalize walkthrough In-Reply-To: References: Message-ID: Your article was by far the most useful when trying to figure out how to 'globalize' my site. Many thanks. If you could add a way to somehow automatically 'grab' text from babbelfish or google translate - it would be a real bonus. -- Posted via http://www.ruby-forum.com/. From zarni.worgl at gmail.com Mon Aug 7 20:23:16 2006 From: zarni.worgl at gmail.com (Zarni Worgl) Date: Tue, 8 Aug 2006 02:23:16 +0200 Subject: [Rails I18n] Globalizing Typo 4.0.0 - S.O.S. Help needed! In-Reply-To: <361C70E3-DD87-4412-8E80-06E63DAEBC14@b-simple.de> References: <361C70E3-DD87-4412-8E80-06E63DAEBC14@b-simple.de> Message-ID: Hey Thomas! Content is based on ActiveRecord:Base... bellow is the head of the Content class and the content_fields method is defined in it. TypoGuid is just a library mixin, generates unique ids. So There must be something clashing the Globalize mixin, which i put/included in environment.rb. The translates method is defined in Globalize::DbTranslate. I can not see why the translates method is not being mixed into the Content class, couse it works fine for other classes, that don't have the content_fields method. :) Thanks for help require 'observer' require 'set' class Content < ActiveRecord::Base include Observable @@content_fields = Hash.new @@html_map = Hash.new def initialize(*args) super(*args) set_default_blog end def set_default_blog if self.blog_id == nil or self.blog_id == 0 self.blog = Blog.default end end class << self def content_fields(*attribs) @@content_fields[self] = ((@@content_fields[self]||[]) + attribs).uniq @@html_map[self] = nil attribs.each do | field | define_method("#{field}=") do | newval | if self[field] != newval changed self[field] = newval if html_map(field) self[html_map(field)] = nil end notify_observers(self, field.to_sym) end self[field] end unless self.method_defined?("#{field}_html") define_method("#{field}_html") do if blog.controller html(blog.controller, field.to_sym) else self["#{field}_html"] end end end end end ... end Thomas Baustert wrote: > Hi Zarni, > > I'm not sure, but is Content a model based on ActiveRecord::Base? > If not, than Article is not a model (any more) and does not define > translates. > > The content_fields seems to a method from TypoGuid. You include the > module > an therefore this method exists. > > > > > Am 05.08.2006 um 13:47 schrieb Zarni Worgl: > >> >> >> `load' >> dependencies.rb:85:in >> ./script/../config/../vendor/rails/activesupport/lib/active_support/ >> from >> >> >> >> -- >> Posted via http://www.ruby-forum.com/. >> _______________________________________________ >> Railsi18n-discussion mailing list >> Railsi18n-discussion at rubyforge.org >> http://rubyforge.org/mailman/listinfo/railsi18n-discussion >> > > --- > Thomas Baustert - Freiberuflicher Softwarecoach > fon: +49(40)411 622 35 mobil: +49(173)23 911 43 > fax: +49(40)411 622 36 > thomas.baustert(at)b-simple.de -- Posted via http://www.ruby-forum.com/. From thomas.baustert at b-simple.de Tue Aug 8 04:15:44 2006 From: thomas.baustert at b-simple.de (Thomas Baustert) Date: Tue, 8 Aug 2006 10:15:44 +0200 Subject: [Rails I18n] Globalizing Typo 4.0.0 - S.O.S. Help needed! In-Reply-To: References: <361C70E3-DD87-4412-8E80-06E63DAEBC14@b-simple.de> Message-ID: <405F222D-4896-4945-A97D-701F4F69010A@b-simple.de> Hi Zarni, sorry, but then I have no idea. If you are sure it is a problem with classes that include TypoGuid you may uncomment all methods of TypoGuid an activate parts of the code one by one (maybe with some pseudo code) until you get the exception. Some work, but you know where the problem is. You may switch the statements class Article < Content translates :body, :extended include TypoGuid content_fields :body, :extended and see what happend. You can further print out all included methods using included_modules() or public_class_methods() f?r class method to see what in your class. May that helps :) Am 08.08.2006 um 02:23 schrieb Zarni Worgl: > Hey Thomas! > > Content is based on ActiveRecord:Base... bellow is the head of the > Content class and the content_fields method is defined in it. TypoGuid > is just a library mixin, generates unique ids. So There must be > something clashing the Globalize mixin, which i put/included in > environment.rb. The translates method is defined in > Globalize::DbTranslate. I can not see why the translates method is not > being mixed into the Content class, couse it works fine for other > classes, that don't have the content_fields method. > > :) Thanks for help > > > require 'observer' > require 'set' > > class Content < ActiveRecord::Base > include Observable > > @@content_fields = Hash.new > @@html_map = Hash.new > > def initialize(*args) > super(*args) > set_default_blog > end > > def set_default_blog > if self.blog_id == nil or self.blog_id == 0 > self.blog = Blog.default > end > end > > class << self > def content_fields(*attribs) > @@content_fields[self] = ((@@content_fields[self]||[]) + > attribs).uniq > @@html_map[self] = nil > attribs.each do | field | > define_method("#{field}=") do | newval | > if self[field] != newval > changed > self[field] = newval > if html_map(field) > self[html_map(field)] = nil > end > notify_observers(self, field.to_sym) > end > self[field] > end > unless self.method_defined?("#{field}_html") > define_method("#{field}_html") do > if blog.controller > html(blog.controller, field.to_sym) > else > self["#{field}_html"] > end > end > end > end > end > > ... > > end > > > > Thomas Baustert wrote: >> Hi Zarni, >> >> I'm not sure, but is Content a model based on ActiveRecord::Base? >> If not, than Article is not a model (any more) and does not define >> translates. >> >> The content_fields seems to a method from TypoGuid. You include the >> module >> an therefore this method exists. >> >> >> >> >> Am 05.08.2006 um 13:47 schrieb Zarni Worgl: >> >>> >>> >>> `load' >>> dependencies.rb:85:in >>> ./script/../config/../vendor/rails/activesupport/lib/active_support/ >>> from >>> >>> >>> >>> -- >>> Posted via http://www.ruby-forum.com/. >>> _______________________________________________ >>> Railsi18n-discussion mailing list >>> Railsi18n-discussion at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/railsi18n-discussion >>> >> >> --- >> Thomas Baustert - Freiberuflicher Softwarecoach >> fon: +49(40)411 622 35 mobil: +49(173)23 911 43 >> fax: +49(40)411 622 36 >> thomas.baustert(at)b-simple.de > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Railsi18n-discussion mailing list > Railsi18n-discussion at rubyforge.org > http://rubyforge.org/mailman/listinfo/railsi18n-discussion > --- Thomas Baustert - Freiberuflicher Softwarecoach fon: +49(40)411 622 35 mobil: +49(173)23 911 43 fax: +49(40)411 622 36 thomas.baustert(at)b-simple.de From eule at space.ch Wed Aug 9 11:03:02 2006 From: eule at space.ch (Kaspar Schiess) Date: Wed, 9 Aug 2006 17:03:02 +0200 Subject: [Rails I18n] Globalize WrongLanguageError on attribute _read_? Message-ID: Dear List, Can somebody enlighten me as to why a WrongLanguageError is thrown when I access a stale copy of a model? I fully understand why such an error is required upon writing to the object, but on read access? It seems to make code more complicated than it needs be. Probably there is some blindingly obvious reason for this that helps me see it. -- code example -- Globalize::Locale.set_base_language 'en-US' p = Page.find(1) #?returns an english page Globalize::Locale.set 'fr-CH' # p is now the 'wrong' language puts p.title # This throws WrongLanguageError. Why? The value is perfectly ok! -- code example -- Thank you for any answer you might have. kaspar -- neotrivium.com - the swiss ruby shop From zarni.worgl at gmail.com Wed Aug 9 20:41:34 2006 From: zarni.worgl at gmail.com (Zarni Worgl) Date: Thu, 10 Aug 2006 02:41:34 +0200 Subject: [Rails I18n] Does Globalize supports properties files In-Reply-To: <138081f7b68801905c69d316d257444e@ruby-forum.com> References: <138081f7b68801905c69d316d257444e@ruby-forum.com> Message-ID: Hey Sathya... i was working on the same problem while globalizing my Typo blog, I can give you all my code if you need it. Here's what I did :) I am saving the user locale in the user session object. application.rb: before_filter :set_locale def set_locale Locale.set LOCALES[session[:locale]] if LOCALES.keys.include?(session[:locale]) true end I set the default locale in environment.rb: #Globalize plugin include Globalize Locale.set_base_language('en-US') Locale.set('en-US') #this is the default site locale LOCALES = { 'English' => 'en-US', 'Slovenian' => 'sl-SI'}.freeze You don't need the whole language name. You could use also LOCALES = { 'en' => 'en-US', 'sl' => 'sl-SI'}.freeze But I did it, so I can display it also :) Then i made links in the view for each language i support. <% LOCALES.each do |loc_key, loc_name| %> <%= link_to Language.pick(LOCALES[loc_key]), {:controller => 'accounts', :action => 'switch_locale', :locale => loc_key } %> <%end%> This method is in my account controller, the method that switches the locale and redirects to a main page, you could redirect anywhere: def switch_locale switch_language redirect_to :controller => "articles", :action => "index" end And switch_language is located in lib/login_system.rb : #language switching def switch_language session[:locale] = params[:locale] unless params[:locale].blank? Locale.set LOCALES[session[:locale]] if LOCALES.keys.include?(session[:locale]) end You could put this method in a helper also. The translations are located in the database. You can even translate your data at the ActiveRecord level: translated :product_name, :product_description Read more on that and everything else on globalize wiki : http://globalize-rails.org/wiki/ But if you translate only static content, then use this method on strings, like this: <%=h "English text".t%> In java you have keys for every translation. With globalize your untranslated strings are the keys! The translations are cached from the db, so you don't need any files, and you can make a scaffold based on the globalize_translations database table, and yoou get your very own translations editor! Hope this helpes a bit :) Oh, and this article is really cool: http://globalize-rails.org/wiki/pages/Examplary+application Enjoy! Sathya wrote: > > Hi, i just wanna know how does Globalize work? Is it capable of reading > data from properties files as in Java? If so where should i define these > properties files? > > I have a scenario where there are some labels in a web page in the > default english > > such as :user code 2: user name 3: user company > > and now user has an option to chose a language of his choice which he > selects from a dropdown provided > > Now how can i display these labels in the chosen user language? If user > opted for Spanish, how can i display these labels in spanish > immediately? > > Thanks in Advance > Sathya -- Posted via http://www.ruby-forum.com/. From sathya.kishore at lgcnsglobal.com Thu Aug 10 01:20:03 2006 From: sathya.kishore at lgcnsglobal.com (Sathya) Date: Thu, 10 Aug 2006 07:20:03 +0200 Subject: [Rails I18n] Does Globalize supports properties files In-Reply-To: References: <138081f7b68801905c69d316d257444e@ruby-forum.com> Message-ID: <1ea240b89fc4fbc3dc01e13df38cb27e@ruby-forum.com> Thanq very much Zarni. Actually i am newbie to Ruby, so part of ur syntax i dont understand, no problem, for the time being iam just evaluating RoR for my project, so i hope i need much more help from you in the future.At first, i need to go through the fundamentals of RoR. Well, Zarni, if you dont mind, i have one more doubt in RoR.. How can i read .properties files in RoR? Where should i store these files and how can i load them in to my rails application? Lastly, does RoR support web services? How can i access a web service through RoR ? Awaiting ur reply Sathya Zarni Worgl wrote: > Hey Sathya... i was working on the same problem while globalizing my > Typo blog, I can give you all my code if you need it. > > Here's what I did :) > > I am saving the user locale in the user session object. application.rb: > > before_filter :set_locale > def set_locale > Locale.set LOCALES[session[:locale]] if > LOCALES.keys.include?(session[:locale]) > true > end > > I set the default locale in environment.rb: > #Globalize plugin > include Globalize > Locale.set_base_language('en-US') > Locale.set('en-US') #this is the default site locale > LOCALES = { 'English' => 'en-US', > 'Slovenian' => 'sl-SI'}.freeze > > You don't need the whole language name. You could use also > LOCALES = { 'en' => 'en-US', > 'sl' => 'sl-SI'}.freeze > But I did it, so I can display it also :) > > > Then i made links in the view for each language i support. > > <% LOCALES.each do |loc_key, loc_name| %> > <%= link_to Language.pick(LOCALES[loc_key]), {:controller => > 'accounts', :action => 'switch_locale', :locale => loc_key } %> > <%end%> > > This method is in my account controller, the method that switches the > locale and redirects to a main page, you could redirect anywhere: > > def switch_locale > switch_language > redirect_to :controller => "articles", :action => "index" > end > > And switch_language is located in lib/login_system.rb : > #language switching > def switch_language > session[:locale] = params[:locale] unless params[:locale].blank? > Locale.set LOCALES[session[:locale]] if > LOCALES.keys.include?(session[:locale]) > end > > You could put this method in a helper also. > > The translations are located in the database. You can even translate > your data at the ActiveRecord level: > translated :product_name, :product_description > > Read more on that and everything else on globalize wiki : > http://globalize-rails.org/wiki/ > > But if you translate only static content, then use this method on > strings, like this: > > <%=h "English text".t%> > > In java you have keys for every translation. With globalize your > untranslated strings are the keys! The translations are cached from the > db, so you don't need any files, and you can make a scaffold based on > the globalize_translations database table, and yoou get your very own > translations editor! > > Hope this helpes a bit :) > > Oh, and this article is really cool: > http://globalize-rails.org/wiki/pages/Examplary+application > > Enjoy! > > Sathya wrote: >> >> Hi, i just wanna know how does Globalize work? Is it capable of reading >> data from properties files as in Java? If so where should i define these >> properties files? >> >> I have a scenario where there are some labels in a web page in the >> default english >> >> such as :user code 2: user name 3: user company >> >> and now user has an option to chose a language of his choice which he >> selects from a dropdown provided >> >> Now how can i display these labels in the chosen user language? If user >> opted for Spanish, how can i display these labels in spanish >> immediately? >> >> Thanks in Advance >> Sathya -- Posted via http://www.ruby-forum.com/. From jesperrr at gmail.com Thu Aug 10 04:45:23 2006 From: jesperrr at gmail.com (=?UTF-8?Q?Jesper_R=C3=B8nn-Jensen?=) Date: Thu, 10 Aug 2006 10:45:23 +0200 Subject: [Rails I18n] Announcing really simple localization plugin Message-ID: Localization Simplified plugin by Jesper R?nn-Jensen. Really simple localization for Rails By Jesper R?nn-Jensen ( http://justaddwater.dk/ ) Languages available: Spanish, German, Swedish, Danish, and ("Swedish Chef" for the fun of it) Plugin available at http://visitjesper.homeip.net/plugins/ IMPORTANT: Plugin directory likely to move to more appropriate location anytime The goal is to have a dead simple plugin for one-language (non-english) Rails applications. Many of the existing localization/internationalization plugins are too big for this and hard to get started with. Just dump this plugin in /vendor/plugins/, set your language and off you go. Unlike the more advanced plugins, you don't have to translate anything in your view files. Just use the standard Rails commands you're used to. The simple approach also makes limits. Make sure you understand them to decide if this plugin is right for you. ===What it does This plugin modifies the following most used helpers for Rails * Sets UTF-8 content-type HTTP header * Sets UTF-8 connection to database * Localized monthnames on date_select etc. (but not changing the order of Y-M-D) * Localized ActiveRecord errors (and error headings) * Localized distance_of_time_in_words * Localized to_currency (but not changing the order of unit/currency) * Simple pluralization also available in the lang-file (but currently only used for pluralizing "error"=>"errors" in local language) * Changes standard Rails methods. In this way, there's no tedious rewrite of localization functions in your view files * Languages available: Spanish, German, Swedish, Danish, and ("Swedish Chef" for the fun of it) Read more in the README file of the project. If you want to help out, I'd really like you to translate into more languages. See more under TODO in the README file. Also, since this is my first plulgin, any feedback is welcome. There is probably something I can do smarter.. -- Jesper R?nn-Jensen http://justaddwater.dk/ (weblog) Plugin available at http://visitjesper.homeip.net/plugins/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/railsi18n-discussion/attachments/20060810/0fbda1b1/attachment.html From zarni.worgl at gmail.com Thu Aug 10 06:11:28 2006 From: zarni.worgl at gmail.com (Zarni Worgl) Date: Thu, 10 Aug 2006 12:11:28 +0200 Subject: [Rails I18n] Does Globalize supports properties files In-Reply-To: <1ea240b89fc4fbc3dc01e13df38cb27e@ruby-forum.com> References: <138081f7b68801905c69d316d257444e@ruby-forum.com> <1ea240b89fc4fbc3dc01e13df38cb27e@ruby-forum.com> Message-ID: <24df6af2ff6a6edb13b693a3cbc81402@ruby-forum.com> If you really really need to use some kind of properties files, then you can use this little goodie : http://mir.aculo.us/articles/2005/10/03/ruby-on-rails-i18n-revisited I used it for a project... works great! Web services with RoR are simple as cake. Read this one: http://www-128.ibm.com/developerworks/java/library/j-cb08016/index.html Knowledge is the mother of Creation ;) Sathya wrote: > Thanq very much Zarni. > > Actually i am newbie to Ruby, so part of ur syntax i dont understand, no > problem, for the time being iam just evaluating RoR for my project, so i > hope i need much more help from you in the future.At first, i need to go > through the fundamentals of RoR. > > Well, Zarni, if you dont mind, i have one more doubt in RoR.. > > How can i read .properties files in RoR? Where should i store these > files and how can i load them in to my rails application? > > Lastly, does RoR support web services? How can i access a web service > through RoR ? > > Awaiting ur reply > Sathya -- Posted via http://www.ruby-forum.com/. From harish4groups at gmail.com Fri Aug 11 09:05:39 2006 From: harish4groups at gmail.com (Naga harish Kanegolla) Date: Fri, 11 Aug 2006 15:05:39 +0200 Subject: [Rails I18n] Rails Application Failed to start Properly In-Reply-To: <414d11c3a6e8e6dbb9839f5ea075a345@ruby-forum.com> References: <414d11c3a6e8e6dbb9839f5ea075a345@ruby-forum.com> Message-ID: Now its working Properly. I just reuploaded the particular file in the server. Actually in that controller I have commented some sytax. Thats why It didn't worked I think. I deleted all the commented ones. Now it worked properly. I donno the reason why it behaved like that. Now I'm happy:) ~Harish -- Posted via http://www.ruby-forum.com/. From jesperrr at gmail.com Sun Aug 13 09:15:28 2006 From: jesperrr at gmail.com (=?UTF-8?Q?Jesper_R=C3=B8nn-Jensen?=) Date: Sun, 13 Aug 2006 15:15:28 +0200 Subject: [Rails I18n] Announcement: Really simple localization plugin Message-ID: I needed something simpler than Globalize and GLoc to localize my Rails application into Danish. I packed it into this plugin. Feel free to use it. Languages available: Spanish, German, Swedish, Danish, and ("Swedish Chef" for the fun of it) Plugin available at http://visitjesper.homeip.net/plugins/ IMPORTANT: Plugin directory likely to move to more appropriate location anytime The goal is to have a dead simple plugin for one-language (non-english) Rails applications. Many of the existing localization/internationalization plugins are too big for this and hard to get started with. Just dump this plugin in /vendor/plugins/, set your language and off you go. Unlike the more advanced plugins, you don't have to translate anything in your view files. Just use the standard Rails commands you're used to. The simple approach also makes limits. Make sure you understand them to decide if this plugin is right for you. ===What it does This plugin modifies the following most used helpers for Rails * Sets UTF-8 content-type HTTP header * Sets UTF-8 connection to database * Localized monthnames on date_select etc. (but not changing the order of Y-M-D) * Localized ActiveRecord errors (and error headings) * Localized distance_of_time_in_words * Localized to_currency (but not changing the order of unit/currency) * Simple pluralization also available in the lang-file (but currently only used for pluralizing "error"=>"errors" in local language) * Changes standard Rails methods. In this way, there's no tedious rewrite of localization functions in your view files * Languages available: Spanish, German, Swedish, Danish, and ("Swedish Chef" for the fun of it) Read more in the README file of the project. If you want to help out, I'd really like you to translate into more languages. See more under TODO in the README file. Also, since this is my first plulgin, any feedback is welcome. There is probably something I can do smarter.. As a side note: Is there somebody here who want's to translate it into "Pirate speak" (world Talk like a pirate day is coming soon...) -- Jesper R?nn-Jensen http://justaddwater.dk/ (weblog) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/railsi18n-discussion/attachments/20060813/cc533a51/attachment-0001.html From rails at stephanejais.com Sun Aug 13 22:21:10 2006 From: rails at stephanejais.com (Stephane JAIS) Date: Mon, 14 Aug 2006 04:21:10 +0200 Subject: [Rails I18n] GetText doesn't work in ActionMailer Message-ID: <35f335a949791bfaf3e50642b8628a12@ruby-forum.com> Hi, I'm using gettext 1.7.0 and rails 1.1.4. Gettext won't translate: * the subject line of my e-mail * the view that renders its body. I have followed the integration guide at: http://manuals.rubyonrails.org/read/chapter/105 Here's what my application controller looks like: class ApplicationController < ActionController::Base before_filter :init_gettext def init_gettext bindtextdomain("myapp", request.cgi) end Here's my ActionMailer: class OrderMailer < ActionMailer::Base def confirm(order) @subject = _("Your order with myapp") The subject is not translated unless I call bindtextdomain right before. The rhtml template that generate the body is just not translated at all. I can still create localized versions of it: cp app/views/order_mailer/confirm.rhtml app/views/order_mailer/confirm_fr.rhtml but that's a little bit disapointing. Any idea how to get that _() function to work everywhere ? Thanks, Stephane. -- Posted via http://www.ruby-forum.com/. From thomas.baustert at b-simple.de Mon Aug 14 01:30:11 2006 From: thomas.baustert at b-simple.de (Thomas Baustert) Date: Mon, 14 Aug 2006 07:30:11 +0200 Subject: [Rails I18n] GetText doesn't work in ActionMailer In-Reply-To: <35f335a949791bfaf3e50642b8628a12@ruby-forum.com> References: <35f335a949791bfaf3e50642b8628a12@ruby-forum.com> Message-ID: <0E9A50A6-5673-4769-8EED-58EDC668285B@b-simple.de> Hi Stephane, I try gettext using: class ApplicationController < ActionController::Base init_gettext "myapp" ... end and it works. Alternative with bindtextdomain: I'm not sure, but when using bindtextdomain for tests it was looking for the mo-file in locale/de/myapp.mo and not in locale/de/LC_MESSAGES/myapp.mo so you may have to try with different directories. Or add a path: add_default_locale_path( File.dirname(__FILE__) + "/locale/%{locale}/LC_MESSAGES/%{name}.mo" ) May it helps. Thomas Am 14.08.2006 um 04:21 schrieb Stephane JAIS: > Hi, > > I'm using gettext 1.7.0 and rails 1.1.4. > > Gettext won't translate: > > * the subject line of my e-mail > * the view that renders its body. > > I have followed the integration guide at: > http://manuals.rubyonrails.org/read/chapter/105 > > Here's what my application controller looks like: > > class ApplicationController < ActionController::Base > before_filter :init_gettext > def init_gettext > bindtextdomain("myapp", request.cgi) > end > > Here's my ActionMailer: > > class OrderMailer < ActionMailer::Base > def confirm(order) > @subject = _("Your order with myapp") > > The subject is not translated unless I call bindtextdomain right > before. > > The rhtml template that generate the body is just not translated at > all. > I can still create localized versions of it: > cp app/views/order_mailer/confirm.rhtml > app/views/order_mailer/confirm_fr.rhtml > but that's a little bit disapointing. > > Any idea how to get that _() function to work everywhere ? > > Thanks, > > Stephane. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Railsi18n-discussion mailing list > Railsi18n-discussion at rubyforge.org > http://rubyforge.org/mailman/listinfo/railsi18n-discussion > --- Thomas Baustert - Freiberuflicher Softwarecoach fon: +49(40)411 622 35 mobil: +49(173)23 911 43 fax: +49(40)411 622 36 thomas.baustert(at)b-simple.de From thomas.baustert at b-simple.de Mon Aug 7 14:48:04 2006 From: thomas.baustert at b-simple.de (Thomas Baustert) Date: Mon, 7 Aug 2006 20:48:04 +0200 Subject: [Rails I18n] Globalize: Collection Messages Message-ID: <8C79FE06-5A29-41B5-A77A-1D6643DC8578@b-simple.de> Hi, as far as I understand is Globalize adding every not translated message to the database during *runtime* of the application? (if method translate() is called) That means one need run the application and visit every page in any constellation to get every message to the database to then afterwards translating them. And this for each language to be supported except the default one? Is there any tool or way right now to collect every message without running the application? Like with Gettext? Or do I misunderstand the function of Globalize in this case? Thanx in advance. Thomas --- Thomas Baustert - Freiberuflicher Softwarecoach fon: +49(40)411 622 35 mobil: +49(173)23 911 43 fax: +49(40)411 622 36 thomas.baustert(at)b-simple.de From mutoh at highway.ne.jp Mon Aug 14 11:35:14 2006 From: mutoh at highway.ne.jp (Masao Mutoh) Date: Tue, 15 Aug 2006 00:35:14 +0900 Subject: [Rails I18n] GetText doesn't work in ActionMailer In-Reply-To: <35f335a949791bfaf3e50642b8628a12@ruby-forum.com> References: <35f335a949791bfaf3e50642b8628a12@ruby-forum.com> Message-ID: <20060815003514.61edd209.mutoh@highway.ne.jp> Hi, It may be a bug of gettext-1.7.0. Could you try this patch to your gettext/rails.rb ? --- rails.rb.old 2006-08-15 00:31:42.000000000 +0900 +++ rails.rb 2006-08-15 00:33:08.000000000 +0900 @@ -60,7 +60,7 @@ # They are remained for backward compatibility. # def bindtextdomain(domainname, options = {}, locale = nil, charset = nil, with_model = true) - opt = {:with_helper => true, :with_model => true} + opt = {:with_helper => true, :with_model => true, :with_mailer => true} if options.kind_of? CGI # For backward compatibility opt.merge!(:cgi => options, :locale => locale, :charset => charset, :with_model => with_model) @@ -73,6 +73,7 @@ ret = _bindtextdomain(domainname, opt) bindtextdomain_to(ActiveRecord::Base, domainname) if opt[:with_model] bindtextdomain_to(ApplicationHelper, domainname) if opt[:with_helper] + bindtextdomain_to(ActionMailer::Base, domainname) if opt[:with_mailer] ret end On Mon, 14 Aug 2006 04:21:10 +0200 Stephane JAIS wrote: > Hi, > > I'm using gettext 1.7.0 and rails 1.1.4. > > Gettext won't translate: > > * the subject line of my e-mail > * the view that renders its body. > > I have followed the integration guide at: > http://manuals.rubyonrails.org/read/chapter/105 > > Here's what my application controller looks like: > > class ApplicationController < ActionController::Base > before_filter :init_gettext > def init_gettext > bindtextdomain("myapp", request.cgi) > end > > Here's my ActionMailer: > > class OrderMailer < ActionMailer::Base > def confirm(order) > @subject = _("Your order with myapp") > > The subject is not translated unless I call bindtextdomain right before. > > The rhtml template that generate the body is just not translated at all. > I can still create localized versions of it: > cp app/views/order_mailer/confirm.rhtml > app/views/order_mailer/confirm_fr.rhtml > but that's a little bit disapointing. > > Any idea how to get that _() function to work everywhere ? > > Thanks, > > Stephane. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Railsi18n-discussion mailing list > Railsi18n-discussion at rubyforge.org > http://rubyforge.org/mailman/listinfo/railsi18n-discussion > -- -- .:% Masao Mutoh From harish4groups at gmail.com Tue Aug 15 08:21:51 2006 From: harish4groups at gmail.com (Naga harish Kanegolla) Date: Tue, 15 Aug 2006 14:21:51 +0200 Subject: [Rails I18n] Ajax and FireFox Message-ID: <2c4d894dd386f202a1b8f155d1b2e68c@ruby-forum.com> Hi all, I have created a new application 1month ago. In that application i have a link Add New. This link is given using Ajax(<%= link_to_remote( 'Add New', :update => "abc", :url =>{ :controller=>"xyz",:action => :new}, :position => "after" ) %>) and also i gave <%= javascript_include_tag 'prototype' %> to define ajax. It worked good and i'm using that application since 1 month. But today when i click on add new i'm not getting the form. Its giving an error "Ajax not defined".Even its not working in my local machine.(all these things,i'm doing using FireFox). So i tried in IE. Its working properly. So what might be the problem? Why its not working in Firefox?? Thanks and Regards, Harish -- Posted via http://www.ruby-forum.com/. From jeroen.houben at lostboys.nl Tue Aug 15 11:03:47 2006 From: jeroen.houben at lostboys.nl (Jeroen Houben) Date: Tue, 15 Aug 2006 17:03:47 +0200 Subject: [Rails I18n] Announcement: Really simple localization plugin In-Reply-To: References: Message-ID: <6ebf0fca370b047d894ee5b5de81effe@example.com> Hi Jesper, I've been doing something similar myself and also ran into this problem: # Modification of ruby constants class Date #:nodoc: #FIXME as these are defined as Ruby constants, they can't be overwritten MONTHNAMES =LocalizationSimplified::DateHelper::Monthnames ABBR_MONTHNAMES =LocalizationSimplified::DateHelper::AbbrMonthnames DAYNAMES =LocalizationSimplified::DateHelper::Daynames ABBR_DAYNAMES =LocalizationSimplified::DateHelper::AbbrDaynames end I don't know if it's really a problem though, it runs fine on my dev server, but you get the ugly warnings though... I'd also be interested in translating this into Dutch. Cheers, Jeroen Jesper R?nn-Jensen wrote: > I needed something simpler than Globalize and GLoc to localize my Rails > application into Danish. I packed it into this plugin. Feel free to use > it. > Languages available: Spanish, German, Swedish, Danish, and ("Swedish > Chef" > for the fun of it) > > Plugin available at http://visitjesper.homeip.net/plugins/ > IMPORTANT: Plugin directory likely to move to more appropriate location > anytime > > The goal is to have a dead simple plugin for one-language (non-english) > Rails applications. > Many of the existing localization/internationalization plugins are too > big > for this and hard to get started with. > Just dump this plugin in /vendor/plugins/, set your language and off you > go. > > Unlike the more advanced plugins, you don't have to translate anything > in > your view files. Just use the standard Rails commands you're used to. > The simple approach also makes limits. Make sure you understand them to > decide if this plugin is right for you. > > > ===What it does > This plugin modifies the following most used helpers for Rails > * Sets UTF-8 content-type HTTP header > * Sets UTF-8 connection to database > * Localized monthnames on date_select etc. (but not changing the order > of > Y-M-D) > * Localized ActiveRecord errors (and error headings) > * Localized distance_of_time_in_words > * Localized to_currency (but not changing the order of unit/currency) > * Simple pluralization also available in the lang-file (but currently > only > used for pluralizing "error"=>"errors" in local language) > * Changes standard Rails methods. In this way, there's no tedious > rewrite of > localization functions in your view files > * Languages available: Spanish, German, Swedish, Danish, and ("Swedish > Chef" > for the fun of it) > > > Read more in the README file of the project. > > If you want to help out, I'd really like you to translate into more > languages. See more under TODO in the README file. > Also, since this is my first plulgin, any feedback is welcome. There is > probably something I can do smarter.. > > > > > > > > As a side note: Is there somebody here who want's to translate it into > "Pirate speak" (world Talk like a pirate day is coming soon...) -- Posted via http://www.ruby-forum.com/. From rails at stephanejais.com Tue Aug 15 16:54:18 2006 From: rails at stephanejais.com (Stephane JAIS) Date: Tue, 15 Aug 2006 22:54:18 +0200 Subject: [Rails I18n] GetText doesn't work in ActionMailer In-Reply-To: <20060815003514.61edd209.mutoh@highway.ne.jp> References: <35f335a949791bfaf3e50642b8628a12@ruby-forum.com> <20060815003514.61edd209.mutoh@highway.ne.jp> Message-ID: <214eb4913352b5780c3644f45f44fcee@example.com> Well, the patch is not doing anything. I'm using version 1.7.0 which is the last version. No mention of 'with_mailer' in the source. $ grep -rs with_mailer /usr/local/lib/ruby/gems/1.8/gems/gettext-1.7.0/ $ Any other idea ? Thanks a lot, Steph. Masao Mutoh wrote: > Hi, > > It may be a bug of gettext-1.7.0. > > Could you try this patch to your gettext/rails.rb ? > > --- rails.rb.old 2006-08-15 00:31:42.000000000 +0900 > +++ rails.rb 2006-08-15 00:33:08.000000000 +0900 > @@ -60,7 +60,7 @@ > # They are remained for backward compatibility. > # > def bindtextdomain(domainname, options = {}, locale = nil, charset > = nil, with_model = true) > - opt = {:with_helper => true, :with_model => true} > + opt = {:with_helper => true, :with_model => true, :with_mailer => > true} > if options.kind_of? CGI > # For backward compatibility > opt.merge!(:cgi => options, :locale => locale, :charset => > charset, :with_model => with_model) > @@ -73,6 +73,7 @@ > ret = _bindtextdomain(domainname, opt) > bindtextdomain_to(ActiveRecord::Base, domainname) if > opt[:with_model] > bindtextdomain_to(ApplicationHelper, domainname) if > opt[:with_helper] > + bindtextdomain_to(ActionMailer::Base, domainname) if > opt[:with_mailer] > ret > end > > > > > On Mon, 14 Aug 2006 04:21:10 +0200 -- Posted via http://www.ruby-forum.com/. From www-data at andreas-s.net Tue Aug 15 17:18:53 2006 From: www-data at andreas-s.net (www-data) Date: Tue, 15 Aug 2006 23:18:53 +0200 Subject: [Rails I18n] Problem with globalize In-Reply-To: References: <0ea02ce7f24b7c274acaf2ace5087a5c@ruby-forum.com> <884a25770605290843j766c014eo16e8297a2be93c84@mail.gmail.com> <608be03558b0dcd8c55dfbb2bbe1663b@ruby-forum.com> Message-ID: > Guido wrote: > > I also had to restart WEBrick before it worked for me. > > d Holla, I guess I've should've been to bed at this time.... So thanx for the hint... a restart did the job for me too! Thanks! -- Posted via http://www.ruby-forum.com/. From mutoh at highway.ne.jp Tue Aug 15 21:15:28 2006 From: mutoh at highway.ne.jp (mutoh at highway.ne.jp) Date: Wed, 16 Aug 2006 10:15:28 +0900 Subject: [Rails I18n] GetText doesn't work in ActionMailer In-Reply-To: <214eb4913352b5780c3644f45f44fcee@example.com> References: <214eb4913352b5780c3644f45f44fcee@example.com> Message-ID: <20060816101528.mutoh@highway.ne.jp> Hi, On Wed Aug 16 05:54:18 JST 2006 Stephane JAIS wrote: > Well, the patch is not doing anything. Did you try it? > I'm using version 1.7.0 which is the last version. > No mention of 'with_mailer' in the source. Of course. Because this patch is against 1.7.0. > > $ grep -rs with_mailer /usr/local/lib/ruby/gems/1.8/gems/gettext-1.7.0/ > $ > > Any other idea ? > > Thanks a lot, > > Steph. > > > > Masao Mutoh wrote: > > Hi, > > > > It may be a bug of gettext-1.7.0. > > > > Could you try this patch to your gettext/rails.rb ? > > > > --- rails.rb.old 2006-08-15 00:31:42.000000000 +0900 > > +++ rails.rb 2006-08-15 00:33:08.000000000 +0900 > > @@ -60,7 +60,7 @@ > > # They are remained for backward compatibility. > > # > > def bindtextdomain(domainname, options = {}, locale = nil, charset > > = nil, with_model = true) > > - opt = {:with_helper => true, :with_model => true} > > + opt = {:with_helper => true, :with_model => true, :with_mailer => > > true} > > if options.kind_of? CGI > > # For backward compatibility > > opt.merge!(:cgi => options, :locale => locale, :charset => > > charset, :with_model => with_model) > > @@ -73,6 +73,7 @@ > > ret = _bindtextdomain(domainname, opt) > > bindtextdomain_to(ActiveRecord::Base, domainname) if > > opt[:with_model] > > bindtextdomain_to(ApplicationHelper, domainname) if > > opt[:with_helper] > > + bindtextdomain_to(ActionMailer::Base, domainname) if > > opt[:with_mailer] > > ret > > end > > > > > > > > > > On Mon, 14 Aug 2006 04:21:10 +0200 > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Railsi18n-discussion mailing list > Railsi18n-discussion at rubyforge.org > http://rubyforge.org/mailman/listinfo/railsi18n-discussion > > From www-data at andreas-s.net Fri Aug 18 05:54:41 2006 From: www-data at andreas-s.net (www-data) Date: Fri, 18 Aug 2006 11:54:41 +0200 Subject: [Rails I18n] Globalize WrongLanguageError on attribute _read_? In-Reply-To: References: Message-ID: Kaspar Schiess wrote: > Dear List, > > Can somebody enlighten me as to why a WrongLanguageError is thrown when > I access a stale copy of a model? I fully understand why such an error > is required upon writing to the object, but on read access? It seems to > make code more complicated than it needs be. Probably there is some > blindingly obvious reason for this that helps me see it. > > -- code example -- > Globalize::Locale.set_base_language 'en-US' > > p = Page.find(1) #?returns an english page > Globalize::Locale.set 'fr-CH' # p is now the 'wrong' language > puts p.title # This throws WrongLanguageError. Why? The value is > perfectly ok! > -- code example -- because you have to reload your object before. the correct language is loaded with the 'find', and with the access reader method. ... Globalize::Locale.set 'fr-CH' p = Page.find(1) puts p.title will be ok. > > Thank you for any answer you might have. > kaspar > -- > neotrivium.com - the swiss ruby shop -- Posted via http://www.ruby-forum.com/. From jesperrr at gmail.com Fri Aug 18 06:17:32 2006 From: jesperrr at gmail.com (=?UTF-8?Q?Jesper_R=C3=B8nn-Jensen?=) Date: Fri, 18 Aug 2006 12:17:32 +0200 Subject: [Rails I18n] Announcement: Really simple localization plugin In-Reply-To: <6ebf0fca370b047d894ee5b5de81effe@example.com> References: <6ebf0fca370b047d894ee5b5de81effe@example.com> Message-ID: Great Jeroen. Please send me your translated lang-file and I'll include it in the next release. Oh i found a bug and updated the released files yesterday after our Copenhagen Rails Meetup. I also added an extra placeholder for day of week on time conversions (of activesupport). Please use the updated lang_en.rb file found at http://visitjesper.homeip.net/plugins/localization_simplified/lib/lang_de.rb as a template. Thanks! /Jesper On 8/15/06, Jeroen Houben wrote: > > Hi Jesper, > > I've been doing something similar myself and also ran into this problem: > > # Modification of ruby constants > class Date #:nodoc: > #FIXME as these are defined as Ruby constants, they can't be > overwritten > MONTHNAMES =LocalizationSimplified::DateHelper::Monthnames > ABBR_MONTHNAMES =LocalizationSimplified::DateHelper::AbbrMonthnames > DAYNAMES =LocalizationSimplified::DateHelper::Daynames > ABBR_DAYNAMES =LocalizationSimplified::DateHelper::AbbrDaynames > end > > I don't know if it's really a problem though, it runs fine on my dev > server, but you get the ugly warnings though... > > I'd also be interested in translating this into Dutch. > > Cheers, > > Jeroen > > Jesper R?nn-Jensen wrote: > > I needed something simpler than Globalize and GLoc to localize my Rails > > application into Danish. I packed it into this plugin. Feel free to use > > it. > > Languages available: Spanish, German, Swedish, Danish, and ("Swedish > > Chef" > > for the fun of it) > > > > Plugin available at http://visitjesper.homeip.net/plugins/ > > IMPORTANT: Plugin directory likely to move to more appropriate location > > anytime > > > > The goal is to have a dead simple plugin for one-language (non-english) > > Rails applications. > > Many of the existing localization/internationalization plugins are too > > big > > for this and hard to get started with. > > Just dump this plugin in /vendor/plugins/, set your language and off you > > go. > > > > Unlike the more advanced plugins, you don't have to translate anything > > in > > your view files. Just use the standard Rails commands you're used to. > > The simple approach also makes limits. Make sure you understand them to > > decide if this plugin is right for you. > > > > > > ===What it does > > This plugin modifies the following most used helpers for Rails > > * Sets UTF-8 content-type HTTP header > > * Sets UTF-8 connection to database > > * Localized monthnames on date_select etc. (but not changing the order > > of > > Y-M-D) > > * Localized ActiveRecord errors (and error headings) > > * Localized distance_of_time_in_words > > * Localized to_currency (but not changing the order of unit/currency) > > * Simple pluralization also available in the lang-file (but currently > > only > > used for pluralizing "error"=>"errors" in local language) > > * Changes standard Rails methods. In this way, there's no tedious > > rewrite of > > localization functions in your view files > > * Languages available: Spanish, German, Swedish, Danish, and ("Swedish > > Chef" > > for the fun of it) > > > > > > Read more in the README file of the project. > > > > If you want to help out, I'd really like you to translate into more > > languages. See more under TODO in the README file. > > Also, since this is my first plulgin, any feedback is welcome. There is > > probably something I can do smarter.. > > > > > > > > > > > > > > > > As a side note: Is there somebody here who want's to translate it into > > "Pirate speak" (world Talk like a pirate day is coming soon...) > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Railsi18n-discussion mailing list > Railsi18n-discussion at rubyforge.org > http://rubyforge.org/mailman/listinfo/railsi18n-discussion -- -- Jesper R?nn-Jensen http://justaddwater.dk/ (weblog) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/railsi18n-discussion/attachments/20060818/33ed1af8/attachment.html From jesperrr at gmail.com Fri Aug 18 06:55:08 2006 From: jesperrr at gmail.com (=?UTF-8?Q?Jesper_R=C3=B8nn-Jensen?=) Date: Fri, 18 Aug 2006 12:55:08 +0200 Subject: [Rails I18n] Announcement: Really simple localization plugin In-Reply-To: References: <6ebf0fca370b047d894ee5b5de81effe@example.com> Message-ID: Embarrassing: The link should have been to the English file and not the German file Here's the correct link: http://visitjesper.homeip.net/plugins/localization_simplified/lib/lang_en.rb On 8/18/06, Jesper R?nn-Jensen wrote: > > > http://visitjesper.homeip.net/plugins/localization_simplified/lib/lang_de.rb > -- Jesper R?nn-Jensen http://justaddwater.dk/ (weblog) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/railsi18n-discussion/attachments/20060818/037c29d6/attachment.html From fabienpenso at gmail.com Mon Aug 21 06:16:45 2006 From: fabienpenso at gmail.com (Fabien Penso) Date: Mon, 21 Aug 2006 12:16:45 +0200 Subject: [Rails I18n] (announce) A multi_lang plugin for views/layouts. Message-ID: <89fe6f1b0608210316r5cc913f7o7719f83364a4d1d0@mail.gmail.com> Hi all. I needed a plugin to display different pages depending of the browser's language. Not something for the code ("gettext like" plugins are fine for that) but more like being able to have different views files to make my life easy when I write a website. You can check the plugin at http://penso.info/svn/rails/plugins/multi_lang/ (feedbacks and criticises are more than welcome) At first I wanted to make something that worked with apache/multiviews too if you used caches_page, but after spending hours on that I figured it out that it would be very difficult with the current way rails works with caches_pages. I ended up with this plugin which does the job. It will work also if you use apache, but rails will detect the language, not multiviews. -- http://penso.info/ From mutoh at highway.ne.jp Mon Aug 21 09:23:33 2006 From: mutoh at highway.ne.jp (Masao Mutoh) Date: Mon, 21 Aug 2006 22:23:33 +0900 Subject: [Rails I18n] (announce) A multi_lang plugin for views/layouts. In-Reply-To: <89fe6f1b0608210316r5cc913f7o7719f83364a4d1d0@mail.gmail.com> References: <89fe6f1b0608210316r5cc913f7o7719f83364a4d1d0@mail.gmail.com> Message-ID: <20060821222333.50dce684.mutoh@highway.ne.jp> Hi, Ruby-GetText-Package already has same feature. The difference is the view's path. - app/views/blog/foo_fr.rhtml (for French) - app/views/blog/foo.rhtml (for others. you can use _("") style in it, too.) See: http://www.yotabanana.com/hiki/ruby-gettext-howto-rails.html#Localized+templates+for+Views%2FActionMailer On Mon, 21 Aug 2006 12:16:45 +0200 "Fabien Penso" wrote: > Hi all. > > I needed a plugin to display different pages depending of the > browser's language. Not something for the code ("gettext like" plugins > are fine for that) but more like being able to have different views > files to make my life easy when I write a website. > > You can check the plugin at http://penso.info/svn/rails/plugins/multi_lang/ > > (feedbacks and criticises are more than welcome) > > At first I wanted to make something that worked with apache/multiviews > too if you used caches_page, but after spending hours on that I > figured it out that it would be very difficult with the current way > rails works with caches_pages. I ended up with this plugin which does > the job. It will work also if you use apache, but rails will detect > the language, not multiviews. > > -- > http://penso.info/ > _______________________________________________ > Railsi18n-discussion mailing list > Railsi18n-discussion at rubyforge.org > http://rubyforge.org/mailman/listinfo/railsi18n-discussion > -- -- .:% Masao Mutoh From fabienpenso at gmail.com Mon Aug 21 09:40:01 2006 From: fabienpenso at gmail.com (Fabien Penso) Date: Mon, 21 Aug 2006 15:40:01 +0200 Subject: [Rails I18n] (announce) A multi_lang plugin for views/layouts. In-Reply-To: <20060821222333.50dce684.mutoh@highway.ne.jp> References: <89fe6f1b0608210316r5cc913f7o7719f83364a4d1d0@mail.gmail.com> <20060821222333.50dce684.mutoh@highway.ne.jp> Message-ID: <89fe6f1b0608210640p6a30a44bwbea6560cd9b31343@mail.gmail.com> On 8/21/06, Masao Mutoh wrote: > Hi, > > Ruby-GetText-Package already has same feature. > > The difference is the view's path. Ah, I missed that feature... I guess I just lost few hours writing mine then. Thanks for the info. > - app/views/blog/foo_fr.rhtml (for French) > - app/views/blog/foo.rhtml (for others. you can use _("") style in it, too.) > > See: > http://www.yotabanana.com/hiki/ruby-gettext-howto-rails.html#Localized+templates+for+Views%2FActionMailer > > > On Mon, 21 Aug 2006 12:16:45 +0200 > "Fabien Penso" wrote: > > > Hi all. > > > > I needed a plugin to display different pages depending of the > > browser's language. Not something for the code ("gettext like" plugins > > are fine for that) but more like being able to have different views > > files to make my life easy when I write a website. > > > > You can check the plugin at http://penso.info/svn/rails/plugins/multi_lang/ > > > > (feedbacks and criticises are more than welcome) > > > > At first I wanted to make something that worked with apache/multiviews > > too if you used caches_page, but after spending hours on that I > > figured it out that it would be very difficult with the current way > > rails works with caches_pages. I ended up with this plugin which does > > the job. It will work also if you use apache, but rails will detect > > the language, not multiviews. > > > > -- > > http://penso.info/ > > _______________________________________________ > > Railsi18n-discussion mailing list > > Railsi18n-discussion at rubyforge.org > > http://rubyforge.org/mailman/listinfo/railsi18n-discussion > > > > > -- > -- > .:% Masao Mutoh > _______________________________________________ > Railsi18n-discussion mailing list > Railsi18n-discussion at rubyforge.org > http://rubyforge.org/mailman/listinfo/railsi18n-discussion > -- http://penso.info/ From eduard.martini at codemart.ro Wed Aug 23 05:23:18 2006 From: eduard.martini at codemart.ro (Eduard) Date: Wed, 23 Aug 2006 11:23:18 +0200 Subject: [Rails I18n] Globalize and more than one dynamic value In-Reply-To: References: Message-ID: Hi, I have also same problem. <%="%s has %d apples and %s has more".t / "Goran" /5 /"Mihai"%> generates 3 strings into the DB and, if you replace Goran with Sven, another 2 strings are inserted into DB. And also if you add a translation for %s has %d apples and %s has more for a specific language, then load the in to that language, the string is added again. Did you solve the problem? -- Posted via http://www.ruby-forum.com/. From thomas.baustert at b-simple.de Wed Aug 23 05:55:39 2006 From: thomas.baustert at b-simple.de (Thomas Baustert) Date: Wed, 23 Aug 2006 11:55:39 +0200 Subject: [Rails I18n] Globalize and more than one dynamic value In-Reply-To: References: Message-ID: Hi Eduard, no, sorry. So far I'm not using globalize and didn't patched anything. I guess, you have to redefined the method fetch() inside .../lib/ globalize/localization/db_view_translator.rb def fetch(key, language, default = nil, arg = nil) .... if num return result.sub('%d', num.to_s) else return arg.nil? ? result : result.sub('%s', arg.to_s) end end Maybe that's all. Thomas Am 23.08.2006 um 11:23 schrieb Eduard: > Hi, I have also same problem. > <%="%s has %d apples and %s has more".t / "Goran" /5 /"Mihai"%> > generates 3 strings into the DB and, if you replace Goran with Sven, > another 2 strings are inserted into DB. > And also if you add a translation for %s has %d apples and %s has more > for a specific language, then load the in to that language, the string > is added again. > > Did you solve the problem? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Railsi18n-discussion mailing list > Railsi18n-discussion at rubyforge.org > http://rubyforge.org/mailman/listinfo/railsi18n-discussion > --- Thomas Baustert - Freiberuflicher Softwarecoach fon: +49(40)411 622 35 mobil: +49(173)23 911 43 fax: +49(40)411 622 36 thomas.baustert(at)b-simple.de From jesperrr at gmail.com Wed Aug 23 08:08:34 2006 From: jesperrr at gmail.com (=?UTF-8?Q?Jesper_R=C3=B8nn-Jensen?=) Date: Wed, 23 Aug 2006 14:08:34 +0200 Subject: [Rails I18n] i18n friendly, plugable Rails Core Message-ID: Below is a copy of a discussion I just posted on Rails Core mailing list. The reason not to take the discussion here is that I think that we all agree on that Rails sometimes can be extremely difficult to deal with on i18n issues. Copy below. Please share your thoughts on Ruby on Rails Core list: http://groups.google.com/group/rubyonrails-core/browse_thread/thread/346cda3cd39e6fa9/c45615100e0f909a#c45615100e0f909a /Jesper ----- In my work with a simple localization plugin, i'm running into a lot of places in the Rails core, where text and other localization specific information is hardcoded. I've included some examples in the bottom of this post. It's hard for an outsider to know, if the hardcoded values are a result of inconsistency in code, or "by design". I hope that we can have a discussion here and see it in the light that most of the localization/internationalization actually have to re-code many Rails core methods. An example: distance_of_time_in_words() are hardcoded and translated into at least 4 different l10n plugins. If it changes in Rails Core, ALL the plugins must be fixed to ensure that the new code is copied to the plugins. Seen from the perspective of a localized app, there should be as few dependencies as possible, so making hooks available for localization is preferred. In the example above, the texts should be available as a variable (like the error messages in ActiveRecord). This would be an ideal solution to some of the most important i18n related issues, and I'd like to know the view of the community on this point. I mean, the modifications can be made relatively easily, but there is also (as always) a cost involved in changes: Of course, it will require a few lines of extra code that could in some cases cost cpu-cycles. I'm not the right person to judge how much overhead. The other cost I see is that some of the existing plugins (that override core Rails methods) will likely break. This cost I see as a healthy one, because it changes to something simpler. There is one point here not worth discussing here in this thread: UTF-8 support in Rails (because that's closely related to Ruby and should be discussed separately). I'd like the discussion here to focus on the relatively small changes that can actually make internationalization much easier. Here are the examples I've found until now. I'd love to hear your comments and let me know if there are other examples here worth mentioning. ActiveRecord::Errors holds an easily configurable Hash of error messages. Very nice. But the actual header for showing the error messages is hardcoded in ActionView::Helpers::ActiveRecordHelper#error_messages_for This is inconsistent and could be fixed very easily, for instance by adding :header and :subheader to the @@error_messages Hash. ActionView::Helpers::DateHelper#datetime_select doesn't support the :order option, which is inconsisten with the ordinary date_select that does support it. This is like saying "we support localized dates but not localized datetimes". ActionView::Helpers::NumberHelpers#to_currency supports localization of :unit, etc. But does not support localization of ordering. An :order option should be added to make it consistent with date_select etc. These are the most obvious examples I encountered while working on my LocalizationSimplified plugin. There are other places as well, but for now lets focus on the low-hanging fruit where we can easily make Rails core more i18n friendly. Jesper R?nn-Jensen http://justaddwater.dk/ LocalizationSimplified info: http://www.agilewebdevelopment.com/plugins/localization_simplified -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/railsi18n-discussion/attachments/20060823/d08e085e/attachment.html From eduard.martini at codemart.ro Wed Aug 23 11:02:13 2006 From: eduard.martini at codemart.ro (Eduard) Date: Wed, 23 Aug 2006 17:02:13 +0200 Subject: [Rails I18n] Globalize: Collection Messages In-Reply-To: <8C79FE06-5A29-41B5-A77A-1D6643DC8578@b-simple.de> References: <8C79FE06-5A29-41B5-A77A-1D6643DC8578@b-simple.de> Message-ID: <074893060ea1875663a3e5ac65709678@ruby-forum.com> THere is no such function. Anyway I have writen one to sarch in all views and controllers and also translate the errr messages. Look here: #this one will parse all views and contrller from disk to search strings that need to be translated. It also will add to the DB the error message as needing translation def get_translatable_strings @strs = [] Dir.glob("#{RAILS_ROOT}/app/views/**/*.rhtml").collect do |f| @strs << File.read(f).scan(/[\"\']([A-Za-z0-9% ]*)[\"\']\.t/) end.uniq.flatten.uniq @new_strs=Array.new @strs=@strs.uniq.sort 0.upto @strs.size-1 do |i| @strs[i].each do |str| @new_strs << str end end @strs = [] Dir.glob("#{RAILS_ROOT}/app/controllers/**/*.rb").collect do |f| @strs << File.read(f).scan(/[\"\']([A-Za-z0-9% ]*)[\"\']\.t/) end.uniq.flatten.uniq @strs=@strs.uniq.sort 0.upto @strs.size-1 do |i| @strs[i].each do |str| @new_strs << str end end @new_strs=@new_strs.uniq.sort Locale::LOCALES.values.each do |loc| Locale.set "#{loc}" @new_strs.each do |str| str.to_s.translate end ActiveRecord::Errors.default_error_messages.each_value do |error_msg| error_msg.translate end end end -- Posted via http://www.ruby-forum.com/. From ondrej at rt.sk Thu Aug 24 16:50:59 2006 From: ondrej at rt.sk (Ondrej Jaura) Date: Thu, 24 Aug 2006 22:50:59 +0200 Subject: [Rails I18n] Globalize and Pluralization Rules Message-ID: <44EE1133.4090204@rt.sk> Hello, Please, where to find some examples how to use pluralization rules in Globalize? I would like to see how to use it also for languages such as Slovak or Polish, where the rules are slightly more complicated. e.g. english: one, more slovak: one, two...four, five and more Thanks. Greetings, Ondrej -- http://www.valibuk.net From eule at space.ch Fri Aug 25 03:33:38 2006 From: eule at space.ch (Kaspar Schiess) Date: Fri, 25 Aug 2006 09:33:38 +0200 Subject: [Rails I18n] Globalize WrongLanguageError on attribute _read_? In-Reply-To: References: Message-ID: > because you have to reload your object before. the correct language is > loaded with the 'find', and with the access reader method. Thank you for answering. I guess the question was more a 'why' than a 'how' question. I really don't see why we would put this limitation forward and not have a 'french instance' always return 'french data' and an 'english instance' always return 'english data'. More localized language context, instead of it being always a global variable. But since I have asked this question, I have used globalize_extension and am quite happy with the resulting code. ie: @page.switch_language(base_language.code) { @page.title } Which is more or less clean. Globalize Extension seems to support these local context switches I was looking for, not requiring me to # change locale # read the value (that I have already in memory, but can't access because of bad GLOBAL locale # change locale back I profoundly dislike this kind of procedural style. Besides, it just screams 'non thread safe' and 'race condition' - implemented as a global variable that is. So there I went and basically answered my own question - that is something of a bad habit. ;) best greetings, kaspar From eduard.martini at codemart.ro Fri Aug 25 08:24:15 2006 From: eduard.martini at codemart.ro (Eduard Martini) Date: Fri, 25 Aug 2006 14:24:15 +0200 Subject: [Rails I18n] Globalize and more than one dynamic value In-Reply-To: References: Message-ID: I solved that problem by adding a new method t_p to the String class. So, we have "%s is tall but %s is %d inchs taller".t_p(["Jim", "Brian", 2]) Just tell me if you still need it Eduard -- Posted via http://www.ruby-forum.com/. From jeroen.houben at lostboys.nl Tue Aug 29 02:14:27 2006 From: jeroen.houben at lostboys.nl (Jeroen) Date: Tue, 29 Aug 2006 08:14:27 +0200 Subject: [Rails I18n] i18n friendly, plugable Rails Core In-Reply-To: References: Message-ID: <7c88707458fa7715e60d913d29fa7b59@ruby-forum.com> Jesper, I totally agree. I'd like to take it one step further. Hardcoded strings are a pain, even if you're *only* targeting english speaking people. It means you cannot change the defaults even if you want those to be English. How hard would it be to create a patch where all the hardcoded strings have been replaced by vars (with the same content)? Is there no way to do that and still maintain BC with other i18n plugins? Jeroen Jesper R?nn-Jensen wrote: > Below is a copy of a discussion I just posted on Rails Core mailing > list. > The reason not to take the discussion here is that I think that we all > agree > on that Rails sometimes can be extremely difficult to deal with on i18n > issues. Copy below. Please share your thoughts on Ruby on Rails Core > list: > http://groups.google.com/group/rubyonrails-core/browse_thread/thread/346cda3cd39e6fa9/c45615100e0f909a#c45615100e0f909a > -- Posted via http://www.ruby-forum.com/. From thomas.schmid+ruby at gmail.com Tue Aug 29 09:01:28 2006 From: thomas.schmid+ruby at gmail.com (Thomas Schmid) Date: Tue, 29 Aug 2006 15:01:28 +0200 Subject: [Rails I18n] Missing find_by_rfc_3066 Message-ID: Hi Everyone, I just started to learn ruby and ruby on rails since I have to get a codebase up and running someone else programmed. I installed everything fine, though when I try to launch WEBrick, I get the following error: => Booting WEBrick... /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1095:in `method_missing': undefined method `find_by_rfc_3066' for Globalize::Language:Class (NoMethodError) from ./script/../config/../vendor/plugins/globalize/lib/globalize/models/language.rb:37:in `pick' from ./script/../config/../config/environment.rb:58 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' I figured out that the globalize plugin is the cause, thus I tried to find the find_by_rfc_3066 method somewhere. But I couldn't find it. Am I missing some ruby packages? I use the latest globalize code base (revision 200 from subversion). Thank you for any help, Thomas -- Posted via http://www.ruby-forum.com/. From thomas.baustert at b-simple.de Tue Aug 29 09:50:19 2006 From: thomas.baustert at b-simple.de (Thomas Baustert) Date: Tue, 29 Aug 2006 15:50:19 +0200 Subject: [Rails I18n] Missing find_by_rfc_3066 In-Reply-To: References: Message-ID: <9E7844BF-31B3-49F9-8FA9-58E18F699F05@b-simple.de> Hi Thomas, because of the *magic of Ruby* and Rails there is no such method in source :) The method is created at runtime and is looking for an attribute of name find_by_NAME in the table that is assoziated with the model. Example: If a table users has an attribute name you can find a user by name with: User.find_by_name "Thomas" User.find_by_name_and_age "Thomas", 42 ... I think your problem is more about a wrong setup of Globalize. Look, if you find a table globalize_languages in your database. That one has the attribute rfc_3066. Am 29.08.2006 um 15:01 schrieb Thomas Schmid: > Hi Everyone, > > I just started to learn ruby and ruby on rails since I have to get a > codebase up and running someone else programmed. I installed > everything > fine, though when I try to launch WEBrick, I get the following error: > > => Booting WEBrick... > /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/ > base.rb:1095:in > `method_missing': undefined method `find_by_rfc_3066' for > Globalize::Language:Class (NoMethodError) > from > ./script/../config/../vendor/plugins/globalize/lib/globalize/models/ > language.rb:37:in > `pick' > from ./script/../config/../config/environment.rb:58 > from > /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in > `require' > > I figured out that the globalize plugin is the cause, thus I tried to > find the find_by_rfc_3066 method somewhere. But I couldn't find it. > Am I > missing some ruby packages? > > I use the latest globalize code base (revision 200 from subversion). > > Thank you for any help, > > Thomas > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Railsi18n-discussion mailing list > Railsi18n-discussion at rubyforge.org > http://rubyforge.org/mailman/listinfo/railsi18n-discussion > --- Thomas Baustert - Freiberuflicher Softwarecoach fon: +49(40)411 622 35 mobil: +49(173)23 911 43 fax: +49(40)411 622 36 thomas.baustert(at)b-simple.de