How to localize a Panel page URL in Drupal

If you've ever created a panel for multiple languages and found yourself wanting to create a URL path for your panel that looks something like this (/en/myenglishpage-mapagefrancaise and /fr/myenglishpage-mapagefrancaise), then these instructions are for you! A URL like that is NOT localized, it's bilingual.

This process was quite tricky to figure out because I kept thinking that Panels was going to let me do it, that i18n's Path Translation would work, or that using two panels was the solution. After exhausting these solutions, URL aliases was the last resort. It turns out that was very easy!

Here's how:

  1. Create your panel page; you only need one. Set a URL path for it in your site's default language (ie. myenglishpage).
     
  2. Setup your panes so that they translate when you toggle languages. If you have views, you can setup the context in your view, if you have text in there, then you can add multiple text panes (one per language) and set visibility rules for each based on languages etc. Get it working so that everything translates when you toggle back and forth between the languages.
     
  3. Now for the URL, create a URL alias (/admin/config/search/path/add). If you're default language is English, then you should create a URL alias for the other languages (e.g. French).
    • ​Set Language to French.
    • Set Existing system path to the path of your panel pane (ie. myenglishpage).
    • Set Path alias to the path you want to use for French mode (ie. mapagefrancaise).
    • Click Save.

That should do it. You will now be able to toggle back and forth between (en/myenglishpage) and (fr/mapagefrancaise). You have now localized your Panel Page's URLs.

Comments

Hey, you might want to check out this new localization tool - http://poeditor.com/ You can easily translate Drupal strings with it.

Brilliant, thank you!

Post new comment

The content of this field is kept private and will not be shown publicly.

Another U7 Solutions - Web-based solutions to everyday business problems. solution.