 
   return obj
 
+toArray = (as) ->
+  args = new Array(as.length)
+  for i in [0...as.length]
+    args[i] = as[i]
+  args
+
 TAPi18n.subscribe = (name) ->
-  args = new Array(arguments.length)
-  for i in [0..arguments.length-1]
-    args[i] = arguments[i]
+  args = toArray arguments
   args.unshift null
   TAPi18n.subscribeWithConnection.apply @, args
 
 TAPi18n.subscribeWithConnection = (connection, name) ->
+  args = toArray arguments
+  args.splice 1, 0, null
+  TAPi18n.subscribeWithConnectionCached.apply @, args
+
+TAPi18n.caches = {}
+
+TAPi18n.subscribeWithConnectionCached = (connection, cacheId, name) ->
 # TAPi18n.subscribe = ->
   local_session = new ReactiveDict
   local_session.set("ready", false)

  subscription = null
  subscription_computation = null
  subscribe = ->
    # subscription_computation, depends on TAPi18n.getLanguage(), to
    # resubscribe once the language gets changed.
    subscription_computation = Deps.autorun () ->
      lang_tag = TAPi18n.getLanguage()

      subscription =
        connection.subscribe.apply connection, removeTrailingUndefs [].concat(name, params, lang_tag, callbacks)

      # if the subscription is already ready:
      local_session.set("ready", subscription.ready())

  # If TAPi18n is called in a computation, to maintain Meteor.subscribe
  # behavior (which never gets invalidated), we don't want the computation to


  # parse arguments
  # params = Array.prototype.slice.call(arguments, shift)
  params = Array.prototype.slice.call(arguments, 3)
  callbacks = {}
  if params.length
    lastParam = params[params.length - 1]
