<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -3,13 +3,13 @@ class JsController extends JsAppController {
   var $name = 'Js';
   var $uses = array('Js.JsLang');
 
-  function lang($lang, $jsFile=null) {
+  function lang() {
     $cache = true;
     if (Configure::read('debug')) {
       $cache = false;
     }
 
-    if ($js = $this-&gt;JsLang-&gt;i18n($lang, $jsFile, $cache)) {
+    if ($js = $this-&gt;JsLang-&gt;i18n($this-&gt;params['pass'], $cache)) {
       header('Content-type: text/javascript');
       echo $js;
       die;</diff>
      <filename>controllers/js_controller.php</filename>
    </modified>
    <modified>
      <diff>@@ -10,25 +10,26 @@ class JsLang extends JsAppModel {
 
   function init() {
     App::import('Core', 'L10n');
-    
+
     $this-&gt;paths['source'] = JS . 'source' . DS;
-    if(Configure::read('Js.paths')) {
+    if (Configure::read('Js.paths')) {
       $this-&gt;paths = array_merge($this-&gt;paths, Configure::read('Js.paths'));
     }
   }
 
-  function i18n($lang, $jsFile=null, $cache=false) {
+  function i18n($params, $cache=false) {
     $this-&gt;init();
-    
-    $cacheFile = $jsFile;
-    if ($jsFile == null &amp;&amp; preg_match('/\.js$/i', $lang)) {
-      $cacheFile = $lang;
+
+    $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';
-      $lang = str_replace('.js', '', $lang);
     } else {
-      $cacheFile = $lang . DS . $cacheFile;
+      $lang = $params[0];
+      unset($params[0]);
+      $jsFile = implode(DS, $params);
     }
-    
+
     $L10n = new L10n();
     if (!$L10n-&gt;map($lang)) {
       $lang = null;
@@ -40,11 +41,11 @@ class JsLang extends JsAppModel {
       ob_start();
       include $sourceJsFile;
       $js = ob_get_clean();
-      
-      if($cache) {
+
+      if ($cache) {
         $this-&gt;write($cacheFile, $js);
       }
-      
+
       return $js;
     }
 </diff>
      <filename>models/js_lang.php</filename>
    </modified>
    <modified>
      <diff>@@ -36,19 +36,19 @@ class JsLangTestCase extends CakeTestCase {
   }
 
   function testI18nEn() {
-    $result = $this-&gt;JsLang-&gt;i18n('en', 'test.js');
+    $result = $this-&gt;JsLang-&gt;i18n(array('en', 'test.js'));
     $expected = 'alert(&quot;Hello World&quot;);';
     $this-&gt;assertEqual($result, $expected);
   }
 
   function testI18nEs() {
-    $result = $this-&gt;JsLang-&gt;i18n('es', 'test.js');
+    $result = $this-&gt;JsLang-&gt;i18n(array('es', 'test.js'));
     $expected = 'alert(&quot;Hola World&quot;);';
     $this-&gt;assertEqual($result, $expected);
   }
 
   function testLangEn() {
-    $result = $this-&gt;JsLang-&gt;i18n('en.js');
+    $result = $this-&gt;JsLang-&gt;i18n(array('en.js'));
     $expected = &lt;&lt;&lt;END
 var Lang =
   {
@@ -59,7 +59,7 @@ END;
   }
 
   function testLangEs() {
-    $result = $this-&gt;JsLang-&gt;i18n('es.js');
+    $result = $this-&gt;JsLang-&gt;i18n(array('es.js'));
     $expected = &lt;&lt;&lt;END
 var Lang =
   {
@@ -69,6 +69,12 @@ END;
     $this-&gt;assertEqual($result, $expected);
   }
 
+  function testLangEnSub() {
+    $result = $this-&gt;JsLang-&gt;i18n(array('en', 'sub', 'sub.js'));
+    $expected = 'alert(&quot;JS in sub folder&quot;);';
+    $this-&gt;assertEqual($result, $expected);
+  }
+  
   function testWrite() {
     $expected = 'alert(&quot;Hola World&quot;);';
     $this-&gt;JsLang-&gt;write('es/test.js', $expected);</diff>
      <filename>tests/cases/models/js_lang.test.php</filename>
    </modified>
    <modified>
      <diff>@@ -15,4 +15,7 @@ msgid &quot;Hello W&quot;
 msgstr &quot;Hello World&quot;
 
 msgid &quot;This is a test&quot;
-msgstr &quot;A test is this&quot;
\ No newline at end of file
+msgstr &quot;A test is this&quot;
+
+msgid &quot;Sub Message&quot;
+msgstr &quot;JS in sub folder&quot;
\ No newline at end of file</diff>
      <filename>tests/test_app/locale/eng/LC_MESSAGES/default.po</filename>
    </modified>
    <modified>
      <diff>@@ -15,4 +15,7 @@ msgid &quot;Hello W&quot;
 msgstr &quot;Hola World&quot;
 
 msgid &quot;This is a test&quot;
-msgstr &quot;El test-o&quot;
\ No newline at end of file
+msgstr &quot;El test-o&quot;
+
+msgid &quot;Sub Message&quot;
+msgstr &quot;El Message Sub&quot;
\ No newline at end of file</diff>
      <filename>tests/test_app/locale/spa/LC_MESSAGES/default.po</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>817861a589fee6b615de9486d9cc8e16d82fa38e</id>
    </parent>
  </parents>
  <author>
    <name>unknown</name>
    <email>matt@mcurry.net</email>
  </author>
  <url>http://github.com/mcurry/js/commit/da8607364c22b47523ee65990847482c3a7aebd7</url>
  <id>da8607364c22b47523ee65990847482c3a7aebd7</id>
  <committed-date>2009-05-28T20:59:49-07:00</committed-date>
  <authored-date>2009-05-28T20:59:49-07:00</authored-date>
  <message>fix js in sub folders</message>
  <tree>b39c971426873b0ee0ed842d2c6fc3b4bbdbf67c</tree>
  <committer>
    <name>unknown</name>
    <email>matt@mcurry.net</email>
  </committer>
</commit>
