I am using kendo-ui for rendering some complex controls on our website mainly used for data-entry. I want to have the content of these controls being translated by sitecore and also have the controls in a separate JavaScript file.
What is the best approach to use sitecore translations and still have a speedy site?
$("#teams").kendoDropDownList({
dataTextField: "TeamName",
dataValueField: "TeamId",
optionLabel: "@Translate.Text("SelectTeam")",
dataSource: {
transport: {
read: {
type: "POST",
url: "/api/teams",
dataType: "json",
}
},
schema: {
type: "json",
data: "Data",
model: {
fields: {
TeamName: { field: "Name", type: "string" },
TeamId: { field: "TeamId", type: "string" }
}
}
}
},
change: function () {
$("#selectedTeam").val($("#teams").val());
}
}).data("kendoDropDownList");
POST
call to Sitecore to get the content? Then you could either 1) override theLanguageResolver
to set theContext.Language
based on your form parameter, or 2) use it in your controller action to ensure you get the right language of items and translations.