<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -22,15 +22,15 @@ This plugin allows you to create javascript files that include Cake's __() funct
             Message1 : &quot;&lt;?php __('Message 1') ?&gt;&quot;,
             Message2 : &quot;&lt;?php __('Message 2') ?&gt;&quot;,
           };
-      - Then include your js file as /js/lang/en.js.  You can substitute &quot;en&quot; with any of the language codes supported.
-        $javascript-&gt;link('/js/lang/en.js');
+      - Then include your js file as lang/en.js.  You can substitute &quot;en&quot; with any of the language codes supported.
+        $javascript-&gt;link('lang/en.js');
     
     b. If you want to include your localized strings right in the javascript code:
       - Put the files in /app/webroot/js/source/.  
         For example if you had a site.js that had a bunch of JavaScript code mized with calles to __() the file would be:
         /app/webroot/js/source/site.js.
-      - Then include your js file as /js/lang/en/site.js.  You can substitute &quot;en&quot; with any of the language codes supported.
-        $javascript-&gt;link('/js/lang/en/site.js');
+      - Then include your js file as lang/en/site.js.  You can substitute &quot;en&quot; with any of the language codes supported.
+        $javascript-&gt;link('lang/en/site.js');
    3. Cache
     - If debug is enabled no files are cached.
     - If debug is off files will be cached to the request location.</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -18,17 +18,17 @@ class JsLang extends JsAppModel {
   }
 
   function i18n($params, $cache=false) {
+    if(!is_array($params)) {
+      $params = explode('/', trim($params, '/'));  
+    }
+    
     $this-&gt;init();
 
     $cacheFile = implode(DS, $params);
-    if (count($params) == 1 &amp;&amp; preg_match('/\.js$/i', $params[0])) {
-      $lang = str_replace('.js', '', $params[0]);
-      $jsFile = 'lang.js';
-    } else {
-      $lang = $params[0];
-      unset($params[0]);
-      $jsFile = implode(DS, $params);
-    }
+    $params = $this-&gt;normalize($params);
+    $jsFile = $this-&gt;parseFile($params);
+    $lang = $this-&gt;parseLang($params);
+    
 
     $L10n = new L10n();
     if (!$L10n-&gt;map($lang)) {
@@ -51,6 +51,36 @@ class JsLang extends JsAppModel {
 
     return false;
   }
+  
+  function parseFile($file) {
+    if (count($file) == 1 &amp;&amp; preg_match('/\.js$/i', $file[0])) {
+      return 'lang.js';
+    } else {
+      unset($file[0]);
+      return implode(DS, $file);
+    }
+  }
+  
+  function parseLang($file) {
+    if (count($file) == 1 &amp;&amp; preg_match('/\.js$/i', $file[0])) {
+      return str_replace('.js', '', $file[0]);
+    } else {
+      return $file[0];
+    }
+  }
+  
+  function normalize($file) {
+    if(!is_array($file)) {
+      $file = explode('/', trim($file, '/'));  
+    }
+    
+    if($file[0] == 'lang') {
+      unset($file[0]);
+      $file = array_values($file);
+    }
+    
+    return $file;
+  }
 
   function write($path, $content) {
     $outJsFile = $this-&gt;paths['js'] . 'lang' . DS . str_replace('/', DS, $path);</diff>
      <filename>models/js_lang.php</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>da8607364c22b47523ee65990847482c3a7aebd7</id>
    </parent>
  </parents>
  <author>
    <name>unknown</name>
    <email>matt@mcurry.net</email>
  </author>
  <url>http://github.com/mcurry/js/commit/53574e907b1fb3f3a8858a954794ce2358ff0154</url>
  <id>53574e907b1fb3f3a8858a954794ce2358ff0154</id>
  <committed-date>2009-05-28T21:58:14-07:00</committed-date>
  <authored-date>2009-05-28T21:58:14-07:00</authored-date>
  <message>support for asset plugin</message>
  <tree>5cf8206592aab74e22184af00e903db12e464a0a</tree>
  <committer>
    <name>unknown</name>
    <email>matt@mcurry.net</email>
  </committer>
</commit>
