I'm trying to get the language from the current node but are unable to get this working.

umbraco.cms.businesslogic.web.Domain.GetDomainsById(
    umbraco.uQuery.GetCurrentNode().Id
).Id

This will return 0 at all times. Any advice where to start looking or are there other methods to acquire the current language id, thanks!

有帮助吗?

解决方案

After some extensive digging in the well functioning dictionary classes I found the UmbracoCultureDictionary library that contains useful stuff like this

new umbraco.MacroEngines.UmbracoCultureDictionary().Language.id

Currently obsoleted and the referenced class Umbraco.Web.Dictionary.DefaultCultureDictionary is Internal, hence the following approach is probably the most compatible at the moment

umbraco.cms.businesslogic.language.Language.GetByCultureCode(
    System.Threading.Thread.CurrentThread.CurrentUICulture.Name
).id 

umbraco.cms.businesslogic.language.Language.GetByCultureCode(
    System.Threading.Thread.CurrentThread.CurrentUICulture.Name
).FriendlyName

umbraco.cms.businesslogic.language.Language.GetByCultureCode(
    System.Threading.Thread.CurrentThread.CurrentUICulture.Name
).CultureAlias
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top