 
     file.dest = file.orig.dest = dest
 
+  addLocaleFolderDest = (file, locale, outputExt) ->
+    throw new TypeError 'Missing the tuna destination path' unless file.dest
+
+    if ext = getExtension file.dest
+      relative = file.dest.slice(file.orig.dest.length + 1)
+      dest = path.join file.orig.dest, locale, path.dirname(relative), path.basename(relative, ext) + setExtension ext
+    else
+      if /(\/|\*+)$/i.test file.dest
+        base = file.dest.split('/')
+        dest = path.join path.join.apply(null, base.slice(0, -1)), locale, base.slice(-1).shift()
+      else
+        dest = path.join file.dest, locale
+
+    dest = dest.replace /\.jade$/i, setExtension outputExt
+    file.dest = file.orig.dest = dest
+
   addLocaleDirnameDest = (file, locale, outputExt) ->
     throw new TypeError 'Missing the template destination path' unless file.dest
 


    options = @options()
    options.i18n = {} unless options.i18n
    { locales, namespace, localeExtension, defaultExt } = options.i18n

    # set default options
    namespace = '$i18n' unless namespace?
    localeExtension = no unless localeExtension?
    defaultExt = '.html' unless defaultExt?

    if locales and locales.length

        config.files = _.cloneDeep(@files).map (file) ->
          if localeExtension
            addLocaleExtensionDest file, locale, defaultExt
          if localeFolders
            addLocaleFolderDest file, locale, defaultExt
          else
            addLocaleDirnameDest file, locale, defaultExt
          file
