I’m using WPML to translate a website. The only major issue I have with WPML is that you cannot have a page in different languages with the same slug.
Therefore www.example.com/contact/ and www.example.com/fr/contact/ is not possible.
To get around this I was thinking of saving the french version as www.example.com/fr/contact-fr/ in the database but have this transparent to the user. To do that I was thinking of manipulating the URL so the the user sees www.example.com/fr/contact/ but WordPress handles it as if the page were www.example.com/fr/contact-fr/
Is it possible to do this with a function or rewrites?
i’m not familiair with WPML, but i do know that qTranslate has the feature your describing.
I don’t know how WPML impacts the handling of the rewrite rules, but it should be possible to create a rewrite rule that constructs the pagename from two different parts of the rewrite pattern. From the top of my head:
If you are going to do avanced stuff with rewrite rules you might want to install my Rewrite Analyzer plugin to try stuff out.
It will be easier to become a bit more creative with titles/slugs.
Also keep in mind that title and slug do not necessarily need to be the same.
So the title of the French contact page can still be “Contact” and then the slug can become “contactez-nous”.