How to get the culture of the current page/document

Kayla Johnson asked on October 21, 2014 00:58

I'm writing a transformation and need to get the culture of the page/document. I've tried

CMS.DocumentEngine.PageInfo.DocumentCulture or CMS.DocumentEngine.TreeNode.DocumentCulture

But keep getting an error An object reference is required for the non-static field, method, or property 'CMS.DocumentEngine.TreeNode.DocumentCulture.get'

What am I doing wrong? Or is there an easier way?

Correct Answer

Jan Hermann answered on October 21, 2014 09:08

Hello,

please use following code instead:

CMS.DocumentEngine.DocumentContext.CurrentDocument.DocumentCulture

Best regards,
Jan Hermann

1 votesVote for this answer Unmark Correct answer

Recent Answers


Wajd Haikal answered on May 22, 2015 21:08 (last edited on May 22, 2015 21:09)

It was a grate answer for my searches Great Idea finally it worked !!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.