> > > Date: Fri, 30 Sep 2005 12:31:37 -0700 > From: snacktime <snacktime-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > Subject: Re: [Rails] RoR tying into Python''s Twisted > > It doesn''t. Why do you need an event based framework? Don''t get me wrong I > use twisted and it''s great for some things, but depending on what you are > using it for it might not be any better than using ruby threads. And using > an event based framework like twisted where everything has to be non > blocking is definitely a learning curve. > > ChrisHi Chris. Well the reason I was looking into Twisted was for a pet project in my spare time. Its a game along the lines of: http://moock.org/unity/showcase/screenshots/hiddenanddangerous.gif http://moock.org/unity/showcase/screenshots/junglewar.gif These were originally done in Flash with the Unity server on the backend. I had actually built an entire game engine in Flash and Unity, but never got to deploy the actual game due to the fact I couldn''t get anyone who wanted to do the graphics for the game - and I really suck at graphics (I''m a programmer, not an artist). So that went nowhere in the end. The plan now is to either do something along the same lines (with horrible graphics) or some sort of MUD that all runs in a browser. The idea I am keen on is doing this without Flash and doing it using RoR with AJAX calls. Seemed like Twisted would be a good backend for such a thing, but I haven''t done enough with it to be sure. I certainly don''t want to end up "polling" a web server because performance will not be very good for more than a handfull of players (these games are all multiplayer with chat going on). Really, its an experiment more than anything to see if it can be done. Chad _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
> > > Hi Chris. Well the reason I was looking into Twisted was for a pet project > in my spare time. Its a game along the lines of: > http://moock.org/unity/showcase/screenshots/hiddenanddangerous.gif > http://moock.org/unity/showcase/screenshots/junglewar.gif > These were originally done in Flash with the Unity server on the backend. > I had actually built an entire game engine in Flash and Unity, but never got > to deploy the actual game due to the fact I couldn''t get anyone who wanted > to do the graphics for the game - and I really suck at graphics (I''m a > programmer, not an artist). So that went nowhere in the end. > > The plan now is to either do something along the same lines (with horrible > graphics) or some sort of MUD that all runs in a browser. The idea I am keen > on is doing this without Flash and doing it using RoR with AJAX calls. > Seemed like Twisted would be a good backend for such a thing, but I haven''t > done enough with it to be sure. I certainly don''t want to end up "polling" a > web server because performance will not be very good for more than a > handfull of players (these games are all multiplayer with chat going on). > Really, its an experiment more than anything to see if it can be done. > > Chad >That would definitely be something suited to twisted, but since ajax can only communicate with the webserver using the same port number, it''s problematic. If I could find a way to be able to have ajax communicate with rails and with a twisted application on another ip or port, I would jump at it because I have a couple of applications myself that could use that. The only thing I have been able to think of that''s clean would be to have a proxy that can route the request to rails or twisted based on a header field in the http request or something similar. But that adds it''s own overhead also. You might just be better off using twisted and the prototype library that rails uses without rails. Chris _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Just wondering if anyone has set up a localised version of Rails. With this I mean translated messages for required fields and the like and translated files for handling pluralisation ? And offcourse pushing my luck, is there anyone who has done this for a dutch version ? It might also be a good future feature of rails to handle this depending on browser language settings, if this isn''t already the case :) _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I would also be interested in an updated status of I18n/l10n in rails. Last time I checked, the consensus was to say : use gettext. At least one project had started that proposed to integrate this support into rails to make it easier to use. Another one seemed to have started an entirely new effort to make a full ruby solution. What is the current status/consensus on this ? I am starting a project, which needs to be both in french and in english, so I will soon review the available solutions. jean On 10/2/05, Mischa Kroon <mischa.kroon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Just wondering if anyone has set up a localised version of Rails. > > With this I mean translated messages for required fields and the like and > translated files for handling pluralisation ? > > And offcourse pushing my luck, is there anyone who has done this for a dutch > version ? > > It might also be a good future feature of rails to handle this depending on > browser language settings, if this isn''t already the case :) > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
On Monday 03 October 2005 11:48, Jean Helou wrote:> I would also be interested in an updated status of I18n/l10n in > rails. Last time I checked, the consensus was to say : use gettext. > At least one project had started that proposed to integrate this > support into rails to make it easier to use. Another one seemed to > have started an entirely new effort to make a full ruby solution.I''d like to point out that to the best of my knowledge all these projects are only concerned with supporting messages in different languages. There''s more to localization than that. For instance, time, date, currency, even number formats differ between locales. Michael -- Michael Schuerig Life is what happens mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org While you''re making plans http://www.schuerig.de/michael/ --Kevin Gilbert, A Long Day''s Life
On 10/3/05, Michael Schuerig <michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org> wrote:> On Monday 03 October 2005 11:48, Jean Helou wrote: > > I would also be interested in an updated status of I18n/l10n in > > rails. Last time I checked, the consensus was to say : use gettext. > > At least one project had started that proposed to integrate this > > support into rails to make it easier to use. Another one seemed to > > have started an entirely new effort to make a full ruby solution. > > I''d like to point out that to the best of my knowledge all these > projects are only concerned with supporting messages in different > languages. There''s more to localization than that. For instance, time, > date, currency, even number formats differ between locales. >This is true, but standard and easy internationalization of the messages would already be a good start. Localization will be next. jean
Speaking of localiz(s)ation, there''s an interesting article on web development trends for 2006 at http://www.dashes.com/anil/2005/09/06/web_development One section is called "Helping Ruby Grow Up" and localis(z)ation is called out as something that needs work. As is scaling up to enterprise level. Since I only speak English, I''ve chosen to work on the scalability aspects. :) Jean Helou wrote:>I would also be interested in an updated status of I18n/l10n in rails. >Last time I checked, the consensus was to say : use gettext. At least >one project had started that proposed to integrate this support into >rails to make it easier to use. Another one seemed to have started an >entirely new effort to make a full ruby solution. > >What is the current status/consensus on this ? I am starting a >project, which needs to be both in french and in english, so I will >soon review the available solutions. > >jean >-- M. Edward (Ed) Borasky http://www.borasky-research.net/ http://borasky-research.blogspot.com/ http://pdxneurosemantics.com http://pdx-sales-coach.com http://algocompsynth.com
On 10/3/05, M. Edward (Ed) Borasky <znmeb-2WxwdZd67h7R7s880joybQ@public.gmane.org> wrote:> Speaking of localiz(s)ation, there''s an interesting article on web > development trends for 2006 atSpeaking of localiz(s)ation, what I''d like to have is the following. A browser comes, it sends its language to be in order of preference "fr, en", and calls for the action "list". Rails would then look for templates the following way: 1. app/views/controller/list.fr.rhtml 2. app/views/controller/list.en.rhtml 3. app/views/controller/list.rhtml and would finaly store the page in the same filename if cache_pages is triggered. It should be possible to force which language should be used calling urls like : http://website.com/controller/list.fr.html (note the extension). Any feedbacks about that way to do things ?
Sounds like a lot of repeated code in the templates. How about wrapping the blocks of contiguous text in the template that are localized in something like <% localize { %> Default text that I would like localized. <% } %> or <%= localize ''A snippet of text to translate'' %> Then you could have a localization screen (or mode) that showed you the default text snippets and gave you input fields and controls for saving their translations to the db. Translation at runtime could be automatic. On 10/3/05, Fabien Penso <fabienpenso-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 10/3/05, M. Edward (Ed) Borasky <znmeb-2WxwdZd67h7R7s880joybQ@public.gmane.org> wrote: > > Speaking of localiz(s)ation, there''s an interesting article on web > > development trends for 2006 at > > Speaking of localiz(s)ation, what I''d like to have is the following. > > A browser comes, it sends its language to be in order of preference > "fr, en", and calls for the action "list". Rails would then look for > templates the following way: > > 1. app/views/controller/list.fr.rhtml > 2. app/views/controller/list.en.rhtml > 3. app/views/controller/list.rhtml > > and would finaly store the page in the same filename if cache_pages is > triggered. It should be possible to force which language should be > used calling urls like : > > http://website.com/controller/list.fr.html > > (note the extension). > > Any feedbacks about that way to do things ? > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
On 10/3/05, Obie Fernandez <obiefernandez-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Sounds like a lot of repeated code in the templates.At least it gives power. You can use partials for repeating code.> How about wrapping the blocks of contiguous text in the template that > are localized in something like> Then you could have a localization screen (or mode) that showed you > the default text snippets and gave you input fields and controls for > saving their translations to the db. > > Translation at runtime could be automatic.How do you catch up with cache_pages ?
> > Speaking of localiz(s)ation, what I''d like to have is the following. > > A browser comes, it sends its language to be in order of preference > "fr, en", and calls for the action "list". Rails would then look for > templates the following way: >hello, i believe that using the browser''s language for this is not sufficient. i am using english locale in my browser, but read other languages when they are available on a page. the system must recognise locales set up using other means too. i think. :-) konstantin
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Oct 3, 2005, at 12:03 PM, akonsu wrote:>> Speaking of localiz(s)ation, what I''d like to have is the following. >> >> A browser comes, it sends its language to be in order of preference >> "fr, en", and calls for the action "list". Rails would then look for >> templates the following way: > > hello, i believe that using the browser''s language for this is not > sufficient. i am using english locale in my browser, but read other > languages when they are available on a page. the system must recognise > locales set up using other means too. i think. :-)Here is a sketch for automatic language negotiation: http://article.gmane.org/gmane.comp.lang.ruby.rails/12168 The Accept-Language header is never enough -- it''s better to have the user choose their language (by clicking a link, say) and store their preference in a cookie. Best, jeremy -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (Darwin) iD8DBQFDQYZgAQHALep9HFYRAoYjAKCJxkO6Y9/4f634HIQ0quHuAGJf6wCghcyB NRniYkDQtkxj8z7rHUjWWgk=Wl1r -----END PGP SIGNATURE-----
I''ve updated my article on a simple pure-ruby solution to support lambda/Proc.new-style blocks, which can be a possible solution for that, have a look at http://mir.aculo.us/articles/2005/10/03/ruby-on-rails-i18n-revisited Basically, you can define translations like that: Localization.define do |l| l.store ''(time)'', lambda { |t| t.strftime(''%I:%M%p'') } end Localization.define(''de_DE'') do |l| l.store ''(time)'', lambda { |t| t.strftime(''%H:%M'') } end And make calls like this: Localization.lang = :default _ ''(time)'', Time.now => "10:13PM" Localization.lang = ''de_DE'' _ ''(time)'', Time.now => "22:13" Thomas P.S. Yeah, I know, a lower-case letter "L" is probably a bad name for a variable. :) Am 03.10.2005 um 13:42 schrieb Michael Schuerig:> I''d like to point out that to the best of my knowledge all these > projects are only concerned with supporting messages in different > languages. There''s more to localization than that. For instance, time, > date, currency, even number formats differ between locales.
On Monday 03 October 2005 22:22, Thomas Fuchs wrote:> I''ve updated my article on a simple pure-ruby solution to support > lambda/Proc.new-style blocks, which can be a possible solution for > that, have a look at > > http://mir.aculo.us/articles/2005/10/03/ruby-on-rails-i18n-revisitedI''m using a similar approach to supply formatters in some places. But in general, I think it is still too much hassle to individually i18nify each place where a value is presented to the user or entered. I''ve tried to push this as far into the framework as possible. Below are some (incomplete) excerpts. Michael # included into ActionController::Base somewhere def format_value(value) case value when Date value = value.strftime(@date_format) if @date_format when Time value = value.strftime(@time_format) if @time_format when DateTime value = value.strftime(@date_time_format) if @date_time_format when Float value = value.to_s.sub(''.'', @decimal_separator) if @decimal_separator end value end # somewhere else ActionView::Helpers::InstanceTag.class_eval do alias_method :value_before_type_cast_without_locale, :value_before_type_cast def value_before_type_cast_with_locale @template_object.format_value(value) end alias_method :value_before_type_cast, :value_before_type_cast_with_locale; end # BoilerPlate::Model::I18n is included in AR::Base somewhere module BoilerPlate # :nodoc: module Model # :nodoc: class DateFormatError < ArgumentError # :nodoc: attr_reader :invalid_date def initialize(invalid_date) super("Date can''t be parsed") @invalid_date = invalid_date end end # I18n support for ActiveRecord. module I18n def self.included(base) base.class_eval do unless method_defined?(:write_attribute_with_date_cast) alias_method :write_attribute_without_locale, :write_attribute def write_attribute_with_locale(attr, value) attr_type = column_for_attribute(attr).type begin case attr_type when :date value = cast_to_date(value) when :float value = cast_to_float(value) end rescue ArgumentError # Ignore the exception here and rely on validation to # do its job. logger.debug($!) end write_attribute_without_locale(attr, value) end alias_method :write_attribute, :write_attribute_with_locale cattr_accessor :date_format, :decimal_separator ActiveRecord::Base.date_format ||= ''%Y-%m-%d'' ActiveRecord::Base.decimal_separator end end end def parse_date(value) cast_to_date(value) end module_function :parse_date def convert_to_iso_date(value) parse_date(value).to_s end module_function :convert_to_iso_date protected def cast_to_date(value) case value when nil, '''' nil when String begin Date.strptime(value, ActiveRecord::Base.date_format) rescue ArgumentError raise DateFormatError, value end when Date, Time value else raise ArgumentError, "Argument for cast_to_date must be a String, Date, or Time; was: #{value.inspect}" end end module_function :cast_to_date def cast_to_float(value) if ActiveRecord::Base.decimal_separator && value.kind_of?(String) begin value = Kernel.Float(value.sub(ActiveRecord::Base.decimal_separator, ''.'')) rescue end end value end module_function :cast_to_float end end end -- Michael Schuerig You can twist perceptions mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org Reality won''t budge http://www.schuerig.de/michael/ --Rush, Show Don''t Tell