diff --git a/django/template/__init__.py b/django/template/__init__.py
index 29daa76..ad0e6da 100644
--- a/django/template/__init__.py
+++ b/django/template/__init__.py
@@ -59,6 +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')
 
@@ -910,22 +911,28 @@ class Library(object):
             return func
         return dec
 
-def get_library(module_name):
-    lib = libraries.get(module_name, None)
+def get_library(library_name, full_path=False):
+    lib = libraries.get(library_name, None)
     if not lib:
+        library_names = get_library_names()
         try:
+            module_name = full_path and library_name or library_names[library_name]
+        except KeyError, e:
+            raise InvalidTemplateLibrary("No such library %s, %s" % (library_name, e))
+        try:
+            module_name = full_path and library_name or library_names[library_name]
             mod = __import__(module_name, {}, {}, [''])
         except ImportError, e:
             raise InvalidTemplateLibrary("Could not load template library from %s, %s" % (module_name, e))
         try:
             lib = mod.register
-            libraries[module_name] = lib
+            libraries[library_name] = lib
         except AttributeError:
             raise InvalidTemplateLibrary("Template library %s does not have a variable named 'register'" % 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..f80c664 100644
--- a/django/templatetags/__init__.py
+++ b/django/templatetags/__init__.py
@@ -1,7 +1,27 @@
 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:
+        library_names['i18n'] = 'django.templatetags.i18n'
+        library_names['cache'] = 'django.templatetags.cache'
+        for a in settings.INSTALLED_APPS:
+            try:
+                appname = a.find('.')!=-1 and a.split('.')[-1] or a
+                name = a + '.templatetags'
+                mod = __import__(name, {}, {}, [''])
+                path = mod.__path__[0]
+                for root, dirs, files in os.walk(path):
+                    if root == path: 
+                        for file in files:
+                            if not file.endswith('.pyc') and not file.startswith('__init__'):
+                                library_name = os.path.splitext(file)[0]
+                                module_path = '%s.%s' % (name, library_name)
+                                if library_name not in library_names:
+                                    library_names[library_name] = module_path
+                                library_names[appname + '.' + library_name] = module_path
+            except ImportError:
+                pass
+    return library_names
