Read more

"rake gettext:findpo" running forever

Dominik Schöler
September 10, 2012Software engineer at makandra GmbH

Under certain circumstances gettext_i18n_rails will hit a near-infinite loop. This occured in Rails 2.3.5 with Haml 3.0.18 and fast_gettext 0.5.10.

Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

gettext_i18n_rails's Haml-Parser compiles the Haml code and delegates the parsing to ruby_parser. Unfortunately, ruby_parser appears to be confused when a string contains both escaped chars (that is, any unicode characters as ndash, umlauts etc.) and #{} blocks, which makes it extremely slow.

The easiest "solution" we came up with was to replace all occurrences of UTF-8 chars with their HTML entities (so "ü" instead of "ü" etc).

Posted by Dominik Schöler to makandra dev (2012-09-10 13:49)