From 9384499f02007d9e72ded3c4d953dfb08a756084 Mon Sep 17 00:00:00 2001
From: Eike Bernhardt <eike.bernhardt@isn-oldenburg.de>
Date: Fri, 13 May 2011 15:52:51 +0200
Subject: [PATCH] If a translation is _not_ found, cache the result, too

---
 modules/locale/locale.module |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/modules/locale/locale.module b/modules/locale/locale.module
index 092eb48..1c53d18 100644
--- a/modules/locale/locale.module
+++ b/modules/locale/locale.module
@@ -383,6 +383,10 @@ function locale($string = NULL, $langcode = NULL, $reset = FALSE) {
         // also a string-history information for later pruning of the tables.
         db_query("UPDATE {locales_source} SET version = '%s' WHERE lid = %d", VERSION, $translation->lid);
         cache_clear_all('locale:', 'cache', TRUE);
+      } elseif (lock_acquire('locale_cache_' . $langcode)) {
+        // cache this, so it doesn't have to be queried over and over again
+        cache_set('locale:'. $langcode, $locale_t[$langcode]);
+        lock_release('locale_cache_' . $langcode);
       }
     }
     else {
-- 
1.7.5.1

