As I know there is not available tool to do like that. Could have tool to translate whole page into anther language https://docs.developers.optimizely.com/content-management-system/docs/optimizely-languages .
But I do not see any available thing like translating only from specific property to property between existed content languages like that.
I suggest that you can make a tool by your own to do your business such as loading all pages of that page type and update this property value in Spanish by that property value in English if it is empty
Hi Calen,
One way you could approach this would be to implement a fallback mechanism so that, if there's no Spanish version of a given property value, it will use the English version. You could modify your model so your property looks like this:
[Display(
Name = "My URL",
GroupName = SystemTabNames.Content,
Order = 500)]
[CultureSpecific]
public virtual Url MyUrl {
get
{
var url = this.GetPropertyValue(p => p.MyUrl);
//If a value has been set, or we're on the master language branch, return the value
if (IsMasterLanguageBranch || url is not null)
{
return url;
}
//Get the value from the master language
return this.GetFallbackValue<Url>("MyUrl");
}
set => this.SetPropertyValue(p => p.MyUrl, value);
}
Where the GetFallbackValue extension method looks like this:
public static class LanguageFallbackExtensions
{
public static T GetFallbackValue<T>(this IContent content, string propertyName)
{
var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();
var masterContent = contentLoader.Get<IContent>(content.ContentLink.ToReferenceWithoutVersion(), (content as ILocalizable).MasterLanguage);
return masterContent.TryGetPropertyValue<T>(propertyName);
}
}
This won't modify the content in the CMS but should allow you to make the property editable in Spanish without breaking anything if it's not localised.
Hi all,
I am working with a custom block that has a URL Link property under it. The site I am working with is in both English and Spanish. Currently the link is editable in English but not in Spanish as there is no [CultureSpecific] attribute applied to the property. The Spanish value defaults to where the English is set to.
I am trying to make the Spanish link editable, but adding the [CultureSpecific] attribute wipes away whatever value is in the Spanish site. Is there a way to make it translatable, and have all of the links become auto translated on change? There are a lot of occurences of this link type in Spanish, and having to manually reset them all would be more overhead than a programmatic solution.
Thanks,
Calen