diff --git a/django/template/__init__.py b/django/template/__init__.py
index 29daa76..9b24cba 100644
--- a/django/template/__init__.py
+++ b/django/template/__init__.py
@@ -59,7 +59,7 @@ from django.utils.encoding import smart_unicode, force_unicode
 from django.utils.translation import ugettext as _
 from django.utils.safestring import SafeData, EscapeData, mark_safe, mark_for_escaping
 from django.utils.html import escape
-
+from django.templatetags import get_library_names
 __all__ = ('Template', 'Context', 'RequestContext', 'compile_string')
 
 TOKEN_TEXT = 0
@@ -910,11 +910,13 @@ class Library(object):
             return func
         return dec
 
-def get_library(module_name):
+def get_library(module_name, full_path=False):
     lib = libraries.get(module_name, None)
     if not lib:
+        library_names = get_library_names()
         try:
-            mod = __import__(module_name, {}, {}, [''])
+            library_name = full_path and module_name or library_names[module_name]
+            mod = __import__(library_name, {}, {}, [''])
         except ImportError, e:
             raise InvalidTemplateLibrary("Could not load template library from %s, %s" % (module_name, e))
         try:
@@ -925,7 +927,7 @@ def get_library(module_name):
     return lib
 
 def add_to_builtins(module_name):
-    builtins.append(get_library(module_name))
+    builtins.append(get_library(module_name, full_path=True))
 
 add_to_builtins('django.template.defaulttags')
 add_to_builtins('django.template.defaultfilters')
diff --git a/django/templatetags/__init__.py b/django/templatetags/__init__.py
index 9204535..a4c2931 100644
--- a/django/templatetags/__init__.py
+++ b/django/templatetags/__init__.py
@@ -1,7 +1,23 @@
 from django.conf import settings
+import os
 
-for a in settings.INSTALLED_APPS:
-    try:
-        __path__.extend(__import__(a + '.templatetags', {}, {}, ['']).__path__)
-    except ImportError:
-        pass
+library_names = {}
+
+def get_library_names():
+    if not library_names:
+        for a in settings.INSTALLED_APPS:
+            try:
+                appname = a.find('.')!=-1 and a.split('.')[-1] or a
+                name = a + '.templatetags'
+                mod = __import__(name, {}, {}, [''])
+                for root, dirs, files in os.walk(mod.__path__[0]):
+                    for file in files:
+                        if not file.endswith('.pyc') and not file.startswith('__init__'):
+                            library_name = os.path.splitext(file)[0]
+                            library_names[library_name] = name + '.' + library_name
+                            library_names[appname + '.' + library_name] = name + '.' + library_name
+            except ImportError:
+                pass
+        library_names['i18n'] = 'django.templatetags.i18n'
+        library_names['cache'] = 'django.templatetags.cache'
+    return library_names
