Language suffix in URL for language detection?

Events happening in the community are now at Drupal community events on www.drupal.org.
jneubert's picture

Has anybody managed to use language suffixes for Drupal language detection, e.g.

http://example.com/xyz/about.en
http://example.com/xyz/about.de

I'm currently preparing my first Drupal web site, a Labs site for the IT development team of the ZBW German National Library of Economics. On several other projects we use the above given URI scheme, as suggested by W3C (http://www.w3.org/International/questions/qa-apache-lang-neg) for Apache language negotiation. It works very well for us in the context of linked data projects. You may, with

http://example.com/xyz - reference the thing itself
http://example.com/xyz/about - ask for information about it
http://example.com/xyz/about.en.html - in human readable form, English
http://example.com/xyz/about.de.html - in human readable form, German
http://example.com/xyz/about.ttl - in machine readable form (rdf/turtle, not language specific)

And to me, it feels quite logical, as the least significant part goes rightmost. Anyway, I don't want to break this scheme, especially in case we lateron want to migrate one of the well-established applications to Drupal.

Drupal currently supports, as far as I can see, two URL schemes for language detection: Path prefix and domain. Is there a way to enhance this to language suffixes?

Cheers, Joachim

Comments

Suffixes

kristen pol's picture

I haven't seen anyone do this though you should be able to create some custom code to handle it. Path aliases won't help you because if you were to set up the core negotiation to use "prefixes" and then set up an alias, the alias is tacked on after the language "prefix", e.g.

http://mydomain.com/fr/this/is/my/alias

Check out the Language Cookie and Locale Cookie modules as examples of how to create a custom negotiation method.

Good luck.

Thanks

jneubert's picture

For your hints and for pointing to some code examples. It is also and especially helful to know is a not-yet-solved problem. -- Joachim

Internationalization

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: