Umbraco 7 Api Controller get content url with language
Hi all,
Currently, i got an issue when I am getting the url of item in "UmbracoApiController".
The url always return default language, which is "/xxxx" instead of "/zh-HK/xxxx"
I have set the Culture on umbraco and also add these code before I get the content url.
Thread.CurrentThread.CurrentCulture = new CultureInfo("zh-HK");
Thread.CurrentThread.CurrentUICulture = new CultureInfo(language.Replace("zh-HK");
I think custom Umbraco API's that inherit from UmbracoApiController aren't culture aware. The URL will always be ~/Umbraco/Api/Controller/action no matter which site you call them from.
If you need your API method to know what culture to use, you may have to pass it as a parameter. Something like...
Hi Ben, Sorry for late reply. Yea, I have already pass the language through the parameter, and set the culture. The value which i get from vorto field is fine and correct. However, when i get the item.Url, the URL is always English. So i need to do the modification myself such as add the /lang/ before the url. Is there any wrong? Or it is normal.....
Umbraco 7 Api Controller get content url with language
Hi all,
Currently, i got an issue when I am getting the url of item in "UmbracoApiController".
The url always return default language, which is "/xxxx" instead of "/zh-HK/xxxx" I have set the Culture on umbraco and also add these code before I get the content url.
var url = item.Url;
Any ideas or solution for this case?
I think custom Umbraco API's that inherit from UmbracoApiController aren't culture aware. The URL will always be ~/Umbraco/Api/Controller/action no matter which site you call them from.
If you need your API method to know what culture to use, you may have to pass it as a parameter. Something like...
~/Umbraco/Api/Controller/action?culture=enGB
Hi Ben, Sorry for late reply. Yea, I have already pass the language through the parameter, and set the culture. The value which i get from vorto field is fine and correct. However, when i get the item.Url, the URL is always English. So i need to do the modification myself such as add the /lang/ before the url. Is there any wrong? Or it is normal.....
Thanks~
is working on a reply...