Contextual filters in Views - Filter by taxonomy I have a View with contextual filters. I filter by Content Has Taxonomy ID. The problem is that the website is multilanguage, and the name of the taxonomy may change, have commas, non-common characters (cyrillic, for example), be too long and could be, in fact, different from the friendly URL. 

My idea (which I have used in other projects) is to have the URL in this way: 

www.example.com/en/products/sport-shoes

or

www.example.com/ru/продукты/спортивная-обувь

and from the URL, retrieve the parameters with

$url_arr = explode("/", $_SERVER['REQUEST_URI']);


In this case, $url_arr[2] would contain the taxonomy description(sport-shoes or спортивная-обувь in Russian), which is what I look for. The taxonomy name could be completely different, for example: "Sport shoes, complements, and other wearables".

Then I make a query to the database with db_query() searching by description field ( or better use a EntityFieldQuery), get the ID (the product will be associated to both taxonomy terms and I only need one), and pass the ID to the contextual filter, instead of letting the module Views to guess the ID from the URL (Term name converted to Term ID).

Is this procedure (which works) too convoluted? Is there a simpler and elegant way of doing this?
Retrieving the term ID by name has one considerable downside: If term names change, links may become invalid.

A safer option would be the use of aliases. For each of your terms, generate a URL alias per language that points to the internal view path (containing the term IDs). That way your view won't require custom logic to retrieve the term ID.

You could then expand on that approach and use e.g. the Redirect module to keep track of alias changes.

If you still want to stick to your approach, keep in mind that Drupal provides various functions to deal with paths and arguments. In your case, that one-liner can be simplified to:

$url_arr = arg();