How to get entity from transliterated argument in URL? I have panel, where I have argument: taxonomy term name

term names are transliterated (like "My custom taxonomy title" into my-custom-taxonomy-title)

path is like this: my-custom-list-of-nodes/my-custom-taxonomy-title

How can I get in PHP code (in some hook) original taxonomy term name from argument "my-custom-taxonomy-title"? 

Original string can have diacritics, uppercase, spaces. 
How can I detect Term ID from transliterated argument "my-custom-taxonomy-title" ?
Short answer:

You can't do what you are asking.

Why is that?
While transliterating is a pretty simple procedure that follows a very specific number of steps:
- Replace every character with the corresponding-transliterated version
- If the resulting URL exists, add a -{Insert Number here} at the end until you find a URL that does not exist

reversing the transliteration is not that easy. Think of the extreme case where 5 different nodes/terms/entities have the exact same title. Their transliterated paths would be: /common-title /common-title-0 /common-title-1 /common-title-2 /common-title-3.  

In this case, how do you know which transliterated title corresponds to each entity? Creation date (first one created gets the smallest index)? Besides the fact that this is extremely complex to predict, there may still be problems if a path was updated manually or one of the entities was deleted and a new one was added.



Long answer:

Even though what you are asking is not feasible, you can use a number of different approaches in order to solve the specific problem that you are facing.

Possible Solution 1:
You can use the current_path function. This will return the unaliased path of the currently viewed Drupal page. I am not exactly sure how the panels' pathing system works, but there is a very good chance that you will get something with the term id in it (that's what you need in your hook, right?).

In order to investigate this further in your code, assuming you have devel installed, you can do something like:  

dpm(current_path());


Possible Solution 2:
If the above-mentioned solution does not work, you will need to do some more digging in order to figure out which variables are available. Something that can get you started is a simple:  

dpm(get_defined_vars());


Depending on the results that you will get, you may be able to find the term name somewhere in the defined variables and use taxonomy_get_term_by_name() function to retrieve the tid.