Localize widgets?

Topics: General, Localization, Troubleshooting
May 22, 2015 at 3:44 PM
Edited May 22, 2015 at 3:47 PM
Whenever I try to localize widgets (create a new instance for a chosen language) the core Orchard install with no modifications throws a NullReferenceException on LayerId:
public int LayerId {
            get { return this.As<ICommonPart>().Container.As<LayerPart>().Id; }
        }
Which causes this to not work:
<fieldset>
    @Html.LabelFor(widget => widget.LayerId, T("Layer"))
    @Html.DropDownListFor(widget => widget.LayerId, new SelectList(Model.AvailableLayers, "Id", "Name"))
    <span class="hint">@T("The Layer where the Widget will be rendered.")</span>
</fieldset>
How can there be culture layer filtering for widgets if you can't actually localize them? You also can't use the "Edit Placement" feature in content definition on Widgets - everything widget related that calls LayerId blows up.
Jun 4, 2015 at 10:42 PM
How can there be culture layer filtering for widgets if you can't actually localize them?

As for as I know, you don't actually localize the widgets. You just create a separate widget for each culture, and place it on a culture-specific layer.
Developer
Jun 5, 2015 at 1:31 PM
Yeah absolutely. Just create a layer with the rule of culturecode('en-US') or what ever