How to set 2 letter locale in cakephp

I am new in Cakephp and faced an issue with locale. I am using cakephp 2.9. Example, I want the site url like but currently its running as I tried to change the locale folder name from esp to es, it’s not working. But if i changed that esp folder name to xyz, its working.

So all i got that any name with 3 letter its working fine but not the name with 2 letters. Any solution for this or i miss anything here?

It’s not possible without creating a custom route class or url rewrite to map the 2 letter to the 3 letter. CakePHP 2.x follows the ISO 639-2 (i.e. 3 letter code)

CakePHP 3 uses ISO 639-1 (The 2 letter code)

Thank You for the reply. Can you tell me how to do it in route ?