I have changed languages for flags in Magento. But now for example I change language home page localhost/website/
I click in French flag page goes localhost/website/fr
make translation now I select product go to localhost/website/index.php/fr/productname
now here I change language for example Italian it goes to the home page and give me this url localhost/website/index.php/fr/it
Do this for all languages
I can not solve this problem if you can help me thank you.
Here is the code languages.phtml
<?php if(count($this->getStores())>1): ?>
<div class="form-language">
<div class="langs-wrapper">
<?php foreach ($this->getStores() as $_lang): ?>
<?php if ($_lang->getCode() != 'default'): ?>
<a class="lang-flag" href="<?php echo $this->getCurrentUrl().$_lang->getCode();?>" style="text-decoration:none;" title="<?php echo $_lang->getCode();?>">
<img src="<?php echo $this->getSkinUrl('images/flags/'.$_lang->getCode().'.gif');?>" alt="<?php echo $_lang->getCode();?>">
</a>
<?php endif;?>
<?php endforeach;?>
</div>
</div>
<?php endif;?>