Translations through the API
Does anyone have a sample of how I could
1) Figure out if a taxonomy\label has a translation for a specific culture
2) Programmatically add the translation for said culture.
Can be done in the API, yeah?Hi,
Please refer to the below sample where I have implemented getting the first flat taxonomy that does not have Bulgarian translation and adding the translation to it:
var taxonomyManager = TaxonomyManager.GetManager();
var taxonomy = taxonomyManager.GetTaxa<FlatTaxon>().Select(t =>
new
Taxon = t,
AvailableLanguages = t.AvailableLanguages
)
.Where(t => !t.AvailableLanguages.Contains(
"bg"
))
.Select(t => t.Taxon)
.FirstOrDefault();
taxonomy.SetString(
"Title"
, taxonomy.Title +
"BG"
,
"bg"
);
taxonomyManager.SaveChanges();
using
Telerik.Sitefinity.Model;