Hi,
we are using Kendo Professional in an SPA application (only JS and WebApi) and we have a couple use cases of localization that we cannot achieve using documented methods and practices, so we are turning to this forum for help.
What we have now
We use mainly MVVM and already have a setup that allows us to load the correct culture/messages files and replace data-attributes that contain text with the updated strings; sometimes we have non-mvvm widgets that we call setOptions on manually.
We also have about a dozen custom widgets with texts in options like:
options: {
name:
"..."
,
windowTitle:
null
,
windowHeight:
"50%"
,
windowWidth:
"50%"
,
placeholder:
null
,
inputPlaceholder:
null
,
resultsPlaceholder:
"Type something in the above field"
,
...
}
First use-case: complete app-localization
- What is the right approach to localize widget options? Like input placeholders, windows titles, etc ...
- Is there a way to refresh widgets' data-attributes? (could calling setOptions for every widget, with the new parsed options from the element, be a solution?)
We have looked at stackoverflow, general blogs and this forum but no one seems to have a proposed solution. Only this thread was heading in the right way but it died years ago.
We don't want to put resources in viewmodels because we'd have to refactor many views and because a viewmodel should not be aware of what widget is currently rendered.
Second use-case: single view layout change
We have a custom view (with a single viewmodel) that should have different layout based on a user-selection, currently we are doing this:
- calling kendo.destroy/unbind on the #view
- replacing the innerHTML of the #view
- calling kendo.bind(#view, viewmodel)
This is leading to big memory leaks and general bad performances after 3/4 executions.
What is the correct way of doing this?
Third use-case: single view/widget localization
Additionally, we have a single view that should be localized independently from the rest of the application; currently we are doing as indicated in theuse case nr 2 (destroy, update data-attributes, bind again); we know that this won't localize dates/currencies but we have only custom widgets in this view so it is not a problem for now.
This is causing the same memory leak as above that leads to several Megabytes (if not a Gigabyte) if used ram for the single chrome page if this function is called more than 6-10 times in a row, and the browsed becomes unusable after less than 10 times.
This could be replaced with a setOptions on all the fields if was implemented something like a kendo.refresh($element) that re-parses all data-attributes and calls setOptions.
Thank you in advance.