I found this useful script on the www which returns the basename of your web page's current url.
If you set the suffix argument to an empty string you get the full base name including filename extension.
If you set a suffix like '.htm', you get the basename minus the suffix, assuming your url ends in .htm
You then only need to append it to the directory path to the alternate language folder on your site and then redirect your browser using JS to the new url.
I'm not a Dreamweaver user so I don't know how to integrate this script into your code. Maybe someone else can help or offer a better solution.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"[URL]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd[/URL]">
<html xmlns="[URL]http://www.w3.org/1999/xhtml[/URL]">
<head>
<title></title>
<script type="text/javascript">
function basename(path, suffix) {
// Returns the filename component of the path
//
// version: 910.820
// discuss at: [URL]http://phpjs.org/functions/basename[/URL] // + original by: Kevin van Zonneveld ([URL="http://kevin.vanzonneveld.net/"]http://kevin.vanzonneveld.net[/URL])
// + improved by: Ash Searle ([URL]http://hexmen.com/blog/[/URL])
// + improved by: Lincoln Ramsay
// + improved by: djmix
// * example 1: basename('/www/site/home.htm', '.htm'); // * returns 1: 'home'
// * example 2: basename('ecra.php?p=1');
// * returns 2: 'ecra.php?p=1'
var b = path.replace(/^.*[\/\\]/g, '');
if (typeof(suffix) == 'string' && b.substr(b.length-suffix.length) == suffix) {
b = b.substr(0, b.length-suffix.length);
}
//return b;
alert(b);
}
</script>
</head>
<body onload="basename(window.location.href,'');">
<h1>hello world</h1>
</body>
</html>