From reynard.list at gmail.com Tue Jan 15 14:30:56 2008 From: reynard.list at gmail.com (Reynard) Date: Tue, 15 Jan 2008 14:30:56 -0500 Subject: [gettext-u-en] reloading mo files on the fly Message-ID: <26e148920801151130v43c73f37l66cd60fd446d08c2@mail.gmail.com> Hi, I have set up an application where translators can upload the po file and I want them to be able to view the changes without having to restart mongrel. Currently it seems that my options are: 1. Restarting mongrel everytime someone upload a new translation file. 2. Running in development mode which is really slow Is there a way to reload the mo files on the fly from rails app without restarting? Thanks, Reynard -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/gettext-users-en/attachments/20080115/f067638e/attachment-0001.html From ernesto.jimenez at negonation.com Tue Jan 15 15:00:42 2008 From: ernesto.jimenez at negonation.com (=?UTF-8?Q?Ernesto_Jim=C3=A9nez_Caballero?=) Date: Tue, 15 Jan 2008 21:00:42 +0100 Subject: [gettext-u-en] reloading mo files on the fly In-Reply-To: <26e148920801151130v43c73f37l66cd60fd446d08c2@mail.gmail.com> References: <26e148920801151130v43c73f37l66cd60fd446d08c2@mail.gmail.com> Message-ID: <79665d7b0801151200g26057a25nd4c0d0cd254cbc6c@mail.gmail.com> Hi Reynard, Here are some snippets so you can digg more in the topic :) First of all, changing the mo: File: lib/gettext/textdomain.rb # Sets a new Locale::Object. # * locale: a Locale::Object # * reload: true if the mo-file is reloaded forcely # * Returns: self def set_locale(locale, reload = false) @current_locale = locale load_mo(reload) self end As you see, you can force a reload from the mofile Appart from that gettext caches the strings. I suppose in development mode it seeks in the mo file every time and that is what kills the performance. You have a function for clearing that cache: File: lib/gettext.rb # Clear the cached messages. def clear_cache @@__cache_msgids = {} @@__cache_nmsgids = {} end Hope you will find your way with this :) Regards Ernesto 2008/1/15 Reynard : > Hi, > > I have set up an application where translators can upload the po file and I > want them to be able to view the changes without having to restart mongrel. > Currently it seems that my options are: > 1. Restarting mongrel everytime someone upload a new translation file. > 2. Running in development mode which is really slow > > Is there a way to reload the mo files on the fly from rails app without > restarting? > > Thanks, > Reynard > > _______________________________________________ > gettext-users-en mailing list > gettext-users-en at rubyforge.org > http://rubyforge.org/mailman/listinfo/gettext-users-en > -- Ernesto Jim?nez Caballero Software Engineer Leader Negonation (34) 620 475 382 ernesto.jimenez at negonation.com From reynard.list at gmail.com Tue Jan 15 15:06:40 2008 From: reynard.list at gmail.com (Reynard) Date: Tue, 15 Jan 2008 15:06:40 -0500 Subject: [gettext-u-en] reloading mo files on the fly In-Reply-To: <79665d7b0801151200g26057a25nd4c0d0cd254cbc6c@mail.gmail.com> References: <26e148920801151130v43c73f37l66cd60fd446d08c2@mail.gmail.com> <79665d7b0801151200g26057a25nd4c0d0cd254cbc6c@mail.gmail.com> Message-ID: <26e148920801151206i1d14dfc9u16a165b4453e7c25@mail.gmail.com> Hi Ernesto, Thanks for the hint. I have been looking at the source code too but this will definitely help. I'll try it. - reynard On Jan 15, 2008 3:00 PM, Ernesto Jim?nez Caballero < ernesto.jimenez at negonation.com> wrote: > Hi Reynard, > > Here are some snippets so you can digg more in the topic :) > > First of all, changing the mo: > File: lib/gettext/textdomain.rb > # Sets a new Locale::Object. > # * locale: a Locale::Object > # * reload: true if the mo-file is reloaded forcely > # * Returns: self > def set_locale(locale, reload = false) > @current_locale = locale > load_mo(reload) > self > end > > As you see, you can force a reload from the mofile > > Appart from that gettext caches the strings. I suppose in development > mode it seeks in the mo file every time and that is what kills the > performance. > You have a function for clearing that cache: > File: lib/gettext.rb > # Clear the cached messages. > def clear_cache > @@__cache_msgids = {} > @@__cache_nmsgids = {} > end > > > Hope you will find your way with this :) > > Regards > Ernesto > > 2008/1/15 Reynard : > > Hi, > > > > I have set up an application where translators can upload the po file > and I > > want them to be able to view the changes without having to restart > mongrel. > > Currently it seems that my options are: > > 1. Restarting mongrel everytime someone upload a new translation file. > > 2. Running in development mode which is really slow > > > > Is there a way to reload the mo files on the fly from rails app without > > restarting? > > > > Thanks, > > Reynard > > > > _______________________________________________ > > gettext-users-en mailing list > > gettext-users-en at rubyforge.org > > http://rubyforge.org/mailman/listinfo/gettext-users-en > > > > > > -- > Ernesto Jim?nez Caballero > Software Engineer Leader > Negonation > (34) 620 475 382 > ernesto.jimenez at negonation.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/gettext-users-en/attachments/20080115/f27772b8/attachment.html From mutoh at highway.ne.jp Thu Jan 17 12:12:05 2008 From: mutoh at highway.ne.jp (Masao Mutoh) Date: Fri, 18 Jan 2008 02:12:05 +0900 Subject: [gettext-u-en] reloading mo files on the fly In-Reply-To: <79665d7b0801151200g26057a25nd4c0d0cd254cbc6c@mail.gmail.com> References: <26e148920801151130v43c73f37l66cd60fd446d08c2@mail.gmail.com> <79665d7b0801151200g26057a25nd4c0d0cd254cbc6c@mail.gmail.com> Message-ID: <20080118021205.ff744422.mutoh@highway.ne.jp> Hi, On Tue, 15 Jan 2008 21:00:42 +0100 "Ernesto Jim?nez Caballero" wrote: > Hi Reynard, > > Here are some snippets so you can digg more in the topic :) > > First of all, changing the mo: > File: lib/gettext/textdomain.rb > # Sets a new Locale::Object. > # * locale: a Locale::Object > # * reload: true if the mo-file is reloaded forcely > # * Returns: self > def set_locale(locale, reload = false) > @current_locale = locale > load_mo(reload) > self > end > > As you see, you can force a reload from the mofile > > Appart from that gettext caches the strings. I suppose in development > mode it seeks in the mo file every time and that is what kills the > performance. > You have a function for clearing that cache: > File: lib/gettext.rb > # Clear the cached messages. > def clear_cache > @@__cache_msgids = {} > @@__cache_nmsgids = {} > end 1. In development mode, the messages shouldn't cached. If mo files are updated, they should be reloaded unless restart the server such as Webrick/Mongrel. # It means it kills the performance. 2. In production mode, the messages should be cached in each locales. So, this is a bug. I'll fix it. Thanks. -- .:% Masao Mutoh From erkki at itech.ee Thu Jan 17 12:40:11 2008 From: erkki at itech.ee (Erkki Eilonen) Date: Thu, 17 Jan 2008 19:40:11 +0200 Subject: [gettext-u-en] date/time i18n Message-ID: <5A4D082B-7EEB-4FD2-A19F-5D4E1A6FDA88@itech.ee> Hello, Has date/time i18n been considered something that rgettext should solve? So for example, something like this: >> GetText.locale = 'en_US' => "en_US" >> Time.now.strftime('%b') => "Jan" >> GetText.locale = 'et_EE' => "et_EE" >> Time.now.strftime('%b') => "Jaan" I have patched rgettext to do this for my own use but I'm wondering whats the official standing? If anyone is interested, the patch is available at https:// trac.itech.ee/public/index.fcgi/wiki/RubyGettextDateTime . It's not very complete and not probably the best approach but works for me right now. iTech Solutions Erkki Eilonen erkki at itech.ee -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/gettext-users-en/attachments/20080117/5f2c35c8/attachment.html From mutoh at highway.ne.jp Fri Jan 18 22:02:22 2008 From: mutoh at highway.ne.jp (Masao Mutoh) Date: Sat, 19 Jan 2008 12:02:22 +0900 Subject: [gettext-u-en] date/time i18n In-Reply-To: <5A4D082B-7EEB-4FD2-A19F-5D4E1A6FDA88@itech.ee> References: <5A4D082B-7EEB-4FD2-A19F-5D4E1A6FDA88@itech.ee> Message-ID: <20080119120222.257c820f.mutoh@highway.ne.jp> Hi, On Thu, 17 Jan 2008 19:40:11 +0200 Erkki Eilonen wrote: > Hello, > > Has date/time i18n been considered something that rgettext should solve? > > So for example, something like this: > > >> GetText.locale = 'en_US' > => "en_US" > >> Time.now.strftime('%b') > => "Jan" > >> GetText.locale = 'et_EE' > => "et_EE" > >> Time.now.strftime('%b') > => "Jaan" > > > I have patched rgettext to do this for my own use but I'm wondering > whats the official standing? > > If anyone is interested, the patch is available at https:// > trac.itech.ee/public/index.fcgi/wiki/RubyGettextDateTime . > It's not very complete and not probably the best approach but works > for me right now. Really cool. Why not make this a standalone library(not a patch for gettext) ? -- .:% Masao Mutoh