Create Display form that reads the current language of its parent
-
06-12-2019 - |
Question
Im working in sharepoint server 2010
, with Arabic language pack
installed
my current structure for the sharepoint site like the following:
one SiteCollection:
--------> one English SubSite
--------> one Arabic SubSite
I have one list in the SiteCollection
with two Arabic fields and two English fields
I was planning to create two custom display forms for this list, one for Arabic data (shows the Arabic fields only)
and one for the English data
and since i want to invest these two display forms in the subsites I have, I want to let them automatically identify the current language of the subsite they implemented in, then change their properties like if they were originally created in that subsite.
any good thought how to accomplish that? what is the best practice for this? I've been searching for a while but nothing seems worth implementing
Thank you.
Solution
I can give a start on how to accomplish this.
- Edit the DisplayForm.aspx to include javascript.
- Using Javascript, and client object model in SharePoint, you could first check for UICulture property of SPWeb class which returns the default language of the site. (You will have to include the SP.js file to accomplish this.) Check msdn post for more details.
- After identifying the default language, put conditions to disable the controls using styles in javascript. You can get some hint from here - http://edinkapic.blogspot.com/2007/08/hide-field-from-newformaspx.html