Internationalise URL

I already know how to use the yii message translation service —> Yii::t(‘messages’, ‘message1’), but I’d like to know how to internationalise the URL. For example in English and in Spanish. I tried to put the Yii::t(‘messages’, ‘message1’) in the URL Manager of the config file, but this seems not to work


I usually have 2 controllers that respond to request based on the locale param