Routes for different languages

I have a before filter which localizes strings based on params[:lang].
If :lang is “de” I want my urls to look like this:

mysite.com/de/home/show/1

If it’s empty, localization defaults to english and I want my url to
look like this:

mysite.com/home/show/1

I’ve got the following partial rendered on every page to toggle
languages:

<%= link_to “DE”, :lang => “de” %>
<%= link_to “EN”, :lang => nil %>

Can I cater for both urls with one route? At the moment, I can only get
this working with these two:

map.connect ‘:lang/:controller/:action/:id’
map.connect ‘:controller/:action/:id’