-
Notifications
You must be signed in to change notification settings - Fork 68
Use a Language selector
The following sample demonstrates how to add a Language selector in your widget designer. The Language selector is used to select diferent culture defined in your Sitefinity application. For more information on how to use selectors in Feather, see Use a single content item selector.
-
In your DesignerView.YourView.json file you have to add a scripts array. The content of the file should be similar to:
{ "priority": 1, "components" : ["sf-language-selector"] } ```
**NOTE**: For more information on the scripts that you must load, see [List of selectors scripts](List-of-selectors-scripts).
-
In your designerview-yourview.js place the following snippet right before the definition of your custom view controller:
var designerModule = angular.module('designer'); angular.module('designer').requires.push('sfSelectors'); ``` 3. In your DesignerView.YourView.cshtml place the following tag where you want to render the Language selector:
```html
``` NOTE The “sf-site” attribute is required for the Language selector.
The sf-site attribute is used for loading the culture for the given site provided by this attribute. You can use the optional attribute sf-culture to access the selected culture. The value of this attributes are scope properties (sfCulture and sfSite) that you must add in your widgets controller:
public string Culture
{
get;
set;
}
public string Site
{
get;
set;
}
If you don’t supply a sfSite attribute value the Language selector is not rendered . The Language selector can be combined to work alongside a Site selector to display the selected site's available cultures.
The sf-site has the following JSON properties structure:
{"CultureDisplayNames" : [values],
"Id" : [Guid],
"IsAllowedConfigureModules" : [false/true],
"IsAllowedCreateEdit" : [false/true],
"IsAllowedSetPermissions" : false,
"IsAllowedStartStop" : false,
"IsDefault" : false,
"IsDeleteable" : false,
"IsOffline" : false,
"Name" : "site2",
"SiteMapRootNodeId" : [Guid],
"SiteUrl" : [Url],
"UIStatus" : "[Online/Offline]"}
The sf-culture has the following JSON properties structure:
{"Culture":["en"],
"DisplayName":["English"],
"FieldSuffix":["Value"],
"IsDefault":[true],
"Key":["english-en"],
"ShortName":["en"],
"SitesNames":["site1","site2"],
"SitesUsingCultureAsDefault":["site1","site2"],
"UICulture":["en"]}
Home | What's new | FAQ