I proudly present the first trunk versions of MLL: the Multil Language Library. The MLL can be found at: http://dev.digitpaint.nl/projects/mll Features ===== * Reads locale strings and L10N strings from a YML file * L10N support through gettext, some native functions like a localized Time.strftime is available, but untested and 5 times slower than the native Time.strftime. (If getttext is not available, it will use this pure-ruby version as a fallback) * I18N support with a gettext like function: _("") * Includes a "harvester" for going trough HTML/XML, ERB and Ruby files and extracting strings to localize Transparent rails integration ====================* By just require the ActionController extensions and setting a locale path, controllers and views support _("") on a language that can be set per request. * Can do template translations before they are rendered without having to encapsulate all strings with <%= _("string") %>. This template translation however has to be done through some kind of cache. Note: The library is although usable, in a very early state of development. Not much testing is done with it. All help on making this a better lib, is deeply apprecciated! Kind regards, Flurin Egger
F. Egger schrieb:> I proudly present the first trunk versions of MLL: the Multil Language > Library. > > The MLL can be found at: http://dev.digitpaint.nl/projects/mll > > Features > =====> > * Reads locale strings and L10N strings from a YML file > * L10N support through gettext, some native functions like a > localized Time.strftime is available, but untested and 5 times > slower than the native Time.strftime. (If getttext is not available, it > will use this pure-ruby version as a fallback) > * I18N support with a gettext like function: _("") > * Includes a "harvester" for going trough HTML/XML, ERB and > Ruby files and extracting strings to localize > > > Transparent rails integration > ====================> * By just require the ActionController extensions and setting a > locale path, controllers and views support _("") on a language that > can be set per request. > * Can do template translations before they are rendered without > having to encapsulate all strings with <%= _("string") %>. This > template translation however > has to be done through some kind of cache. > > > Note: The library is although usable, in a very early state of > development. Not much testing is done with it. All help on making this a > better lib, is deeply apprecciated!Fantastic! Thanks, looking forward to future improvements. Sascha
On Jan 31, 2005, at 20:54, F. Egger wrote:> I proudly present the first trunk versions of MLL: the Multil Language > Library. [...]Really, really great! Regards, Thijs -- Fingertips - http://www.fngtps.com Firefox - Take back the web - http://getfirefox.com
This is wonderful. A great start. I think once we get i18n of templates in line, then we might need to look at the validator errors and other text which is generated from within code as opposed to the templates. -rabble On Mon, 31 Jan 2005 21:23:13 +0100, Thijs van der Vossen <t.vandervossen-d8uFP1XuNEbQT0dZR+AlfA@public.gmane.org> wrote:> On Jan 31, 2005, at 20:54, F. Egger wrote: > > I proudly present the first trunk versions of MLL: the Multil Language > > Library. [...] > > Really, really great! > > Regards, > Thijs > > -- > Fingertips - http://www.fngtps.com > Firefox - Take back the web - http://getfirefox.com > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
F. Egger wrote:> * Can do template translations before they are rendered without > having to encapsulate all strings with <%= _("string") %>. This > template translation however > has to be done through some kind of cache.This sounds really great. So I''m just curious as to how the harvester determines where a string ends and begins. Does it just look in-between the tags? Also, forgive me since I''m not too familiar with gettext (I actually helped develop a home-grown system that did much the same thing), but does this basically collect all the strings that are inside the _() and store them in a document for translation? What file format are the strings stored in? Are static locale-specific files generated to make it faster, or are they retrieved from a file/db every time? Thanks, Carl
Amazing work. Mad props On Mon, 31 Jan 2005 20:54:44 +0100, F. Egger <f.egger.mailings-c2BlD8dJSIudKNnQ2JlF7Q@public.gmane.org> wrote:> I proudly present the first trunk versions of MLL: the Multil Language > Library. > > The MLL can be found at: http://dev.digitpaint.nl/projects/mll > > Features > =====> > * Reads locale strings and L10N strings from a YML file > * L10N support through gettext, some native functions like a > localized Time.strftime is available, but untested and 5 times > slower than the native Time.strftime. (If getttext is not available, it > will use this pure-ruby version as a fallback) > * I18N support with a gettext like function: _("") > * Includes a "harvester" for going trough HTML/XML, ERB and > Ruby files and extracting strings to localize > > Transparent rails integration > ====================> * By just require the ActionController extensions and setting a > locale path, controllers and views support _("") on a language that > can be set per request. > * Can do template translations before they are rendered without > having to encapsulate all strings with <%= _("string") %>. This > template translation however > has to be done through some kind of cache. > > Note: The library is although usable, in a very early state of > development. Not much testing is done with it. All help on making this a > better lib, is deeply apprecciated! > > Kind regards, > Flurin Egger > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Tobi http://www.hieraki.org - Open source book authoring http://blog.leetsoft.com - Technical weblog
The harvester actually always uses a lexer, wether it''s for ruby code or for html/xml. When "harvesting" ruby code, it looks for a token of group string that is preceded by the right identification token. When you actually run the code with _("") in it, the method Object._(str) (or when you are running it from rails: ActionController::Base._(str) ) is called, which does the localization. The harvester (and the localizer) for the templates actually uses the Syntax lexer, (also used in Hieraki, if i''m not mistaken). The lexer decides wether something is an element "text" node. This is why the localization process is currently only working in "cache mode": the lexer is relatively slow. Once a template is cached, this should be just as fast as regular templates. Also the cache-templating is designed that it should not break any Rails specific caching mechanisms. This is not tested yet tough. The strings are stored in a YML file, as a hash with a MD5 hash of the original string as the key. Carl Youngblood wrote:> F. Egger wrote: > >> * Can do template translations before they are rendered without >> having to encapsulate all strings with <%= _("string") %>. This >> template translation however >> has to be done through some kind of cache. > > > This sounds really great. So I''m just curious as to how the harvester > determines where a string ends and begins. Does it just look > in-between the tags? Also, forgive me since I''m not too familiar with > gettext (I actually helped develop a home-grown system that did much > the same thing), but does this basically collect all the strings that > are inside the _() and store them in a document for translation? What > file format are the strings stored in? Are static locale-specific > files generated to make it faster, or are they retrieved from a > file/db every time? > > Thanks, > Carl > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails