YetaWF.DataProvider.File Package Documentation


YetaWF.DataProvider.FileDataProvider<KEYTYPE,OBJTYPE>.LocalizeModelAsync Method

Called to translate the data managed by the data provider to another language.

Class: YetaWF.DataProvider.FileDataProvider<KEYTYPE,OBJTYPE>
Namespace: YetaWF.DataProvider
Assembly: YetaWF.DataProvider.File


public Task LocalizeModelAsync(
    string language,
    Func<string,bool> isHtml,
    Func<List<string>,Task<List<string>>> translateStringsAsync,
    Func<string,Task<string>> translateComplexStringAsync );



The target language (see LanguageSettings.json).


A function that can be called by the data provider to test whether a string contains HTML.


A method that can be called to translate a collection of simple strings into the new language. A simple string does not contain HTML or newline characters.


A method that can be called to translate a collection of complex strings into the new language. A complex string can contain HTML and newline characters.


The data provider has to retrieve all records and translate them as needed using the provided translateStringsAsync and translateComplexStringAsync methods, and save the translated data.

The YetaWF.Core.Models.ObjectSupport.TranslateObject method can be used to translate all YetaWF.Core.Models.MultiString instances.

The translated data should be stored separately from the default language (except YetaWF.Core.Models.MultiString, which is part of the record). Using the language parameter, a different folder should be used to store the translated data.

See Also YetaWF.DataProvider.FileDataProvider<KEYTYPE,OBJTYPE> ClassYetaWF.DataProvider.FileYetaWF.Core