String Overrides

warning: Creating default object from empty value in /home/robloach/drupal/6/modules/taxonomy/ on line 33.

Migrating from Locale to String Overrides

The issue with using the Locale module to translate single strings on your site for tweaking text is that it gives you a performance hit. When the Locale module is used for this, it can make a query to the database every time the locale() function is called through t().

Localization ExportThe solution to this is String Overrides, which stores these string replacements in the variables table, which is cached on every page load anyway. The problem with it was that it proved to be quite difficult to migrate from using the Locale method of string replacement to String Overrides. Well, it just got a whole bunch easier.

With version 1.5 of String Overrides, you have the ability to import *.po files. These *.po files can be generated by the Locale module's language. You can see a demonstration of exporting a *.po file from the Locale module in the image on the right.

String Overrides - ImportOnce you have the *.po file, you can visit the String Override settings at admin/settings/stringoverrides, click on Import, select the *.po file, and import the string replacements straight into String Overrides. You can see a screenshot of it on the right.

This functionality is only part of the Drupal 5 version at the moment, and will shortly be ported to Drupal 6 shortly.

String Overrides for Drupal 5

A while ago, I put together a very simple module named String Overrides. It provided an interface that used some new functionality in Drupal 6 to easily replace strings without the use of the locale or i18n modules. For a demonstration of how it works, check out the video. It was designed for Drupal 6 because it relied on locale_custom_strings_en, which is new to Drupal 6. If you have a look at the bottom of your settings.php, you'll see a note about it. There were many requests for a Drupal 5 version of String Overrides, but it was never put into implementation due to its reliance on this core functionality.

Well, the brilliant quicksketch fixed this, creating a very slick backport to Drupal 5. This backport was so elegantly made that it still even uses locale_custom_strings_en, which was actually only meant for Drupal 6. For details on how he did it, see his post about it. So, if you have a site running Drupal 5, and you want a quick and easy way to replace strings, String Overrides is good to go. Thanks, Nate!

Syndicate content