title: Language prefix in url mappings not working in every condition
body: <p>I'm having problem with language mappings. The way I want it to work is that language is encoded in the URL like /appname/de/mycontroller/whatever</p>
  <p>If you go to /appname/mycontroller/action it should check your session and if there is no session pick language based on browser preference and redirect to the language prefixed site. If you have session then it will display English. English does not have en prefix (to make it harder).</p>
  <p>So I created mappings like this:</p>
  <pre><code>class UrlMappings {
      static mappings = {
          &quot;/$lang/$controller/$action?/$id?&quot;{
              constraints {
                  lang(matches:/pl|en/)
              }
          }
          &quot;/$lang/store/$category&quot; {
              controller = &quot;storeItem&quot;
              action = &quot;index&quot;
              constraints {
                  lang(matches:/pl|en/)
              }
          }
          &quot;/$lang/store&quot; {
              controller = &quot;storeItem&quot;
              action = &quot;index&quot;
              constraints {
                  lang(matches:/pl|en/)
              }
          }
         
          
          &quot;/$controller/$action?/$id?&quot;{
              lang=&quot;en&quot;
              constraints {
              }
          }
          &quot;/store/$category&quot; {
              lang=&quot;en&quot;
              controller = &quot;storeItem&quot;
              action = &quot;index&quot;
          }
          &quot;/store&quot; {
              lang=&quot;en&quot;
              controller = &quot;storeItem&quot;
              action = &quot;index&quot;
          }
          
      
        &quot;/&quot;(view:&quot;/index&quot;)
        &quot;500&quot;(view:'/error')
      }
  }
  </code></pre>
  <p>It's not fully working and langs are hardcoded just for now. I think I did something wrong. Some of the reverse mappings work but some don't add language.</p>
  <p>If I use link tag and pass params:[lang:'pl'] then it works but if I add params:[lang:'pl', page:2] then it does not. In the second case both lang and page number become parameters in the query string. What is worse they don't affect the locale so page shows in English.</p>
  <p>Can anyone please point me to the documentation what are the rules of reverse mappings or even better how to implement such language prefix in a good way?</p>