Automatic interface language import for Drupal 6

Gábor Hojtsy's picture

One of my three proposed subprojects for this year's Google Summer of Code was about improvements for Drupal 6 to include the autolocale functionality developed for Drupal 5. As always, putting autolocale module into core is not simply a code copy-paste issue, there are several outstanding issues that need to be worked out. The main problem is that when we need to parse and import a half of a megabyte in translation files, PHP can easily time out. So a batch processing framework was in need to process multiple operations in subsequent HTTP requests. Fortunately yched already did a big amount of groundwork on this, and Jakub Suchy tried to map the batch API to autolocale, so I only needed to dig deeper into these to try to make them work nicely together.

I was warned today that the Drupal 6 code freeze is not that far away anymore, so I'd rather take this into account. What I did today:

  • Got the batch processing patch, and applied to the latest Drupal HEAD.
  • Went through it line-to-line and understood what happens in there. Added lots of comments and cleaned up the code.
  • Took Jakub's PHP source files, and applied the latest autolocale changes to them.
  • Updated the resulting code, applied Drupal code style fixes and also fixed quite a few problems encountered by Jakub.
  • Submitted a core patch for locale module on the way to kill two notices appearing while importing translations.

Now autolocale is capable of initiating a batch, and the batch import runs nicely (it also looks good visually in Garland). Comments from yched on my cleanups seem to be positive and it turned out that he is even farther into core issues, then I have thought. So, hopefully this feature can make it into Drupal 6 soon.

Anybody trying out and commenting on our changes is very much welcome!

Comments

Fantastic

mlncn's picture

Too busy with Drupal 5 to test Drupal 6 yet, but awesome!

~ ben, Agaric Design Collective

benjamin, agaric