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?