diff --git a/src/Umbraco.Core/Models/ContentEditing/Language.cs b/src/Umbraco.Core/Models/ContentEditing/Language.cs index 15e63eabed..112aeb5aac 100644 --- a/src/Umbraco.Core/Models/ContentEditing/Language.cs +++ b/src/Umbraco.Core/Models/ContentEditing/Language.cs @@ -22,6 +22,7 @@ public class Language [DataMember(Name = "isMandatory")] public bool IsMandatory { get; set; } + [Obsolete("This will be replaced by fallback language ISO code in V13.")] [DataMember(Name = "fallbackLanguageId")] public int? FallbackLanguageId { get; set; } } diff --git a/src/Umbraco.Core/Models/DictionaryItem.cs b/src/Umbraco.Core/Models/DictionaryItem.cs index 7473cef60f..90576a85e3 100644 --- a/src/Umbraco.Core/Models/DictionaryItem.cs +++ b/src/Umbraco.Core/Models/DictionaryItem.cs @@ -34,6 +34,7 @@ public class DictionaryItem : EntityBase, IDictionaryItem _translations = new List(); } + [Obsolete("This will be removed in V13.")] public Func? GetLanguage { get; set; } /// diff --git a/src/Umbraco.Core/Models/DictionaryItemExtensions.cs b/src/Umbraco.Core/Models/DictionaryItemExtensions.cs index 3e6c051201..09654d5137 100644 --- a/src/Umbraco.Core/Models/DictionaryItemExtensions.cs +++ b/src/Umbraco.Core/Models/DictionaryItemExtensions.cs @@ -10,6 +10,7 @@ public static class DictionaryItemExtensions /// /// /// + [Obsolete("This will be replaced in V13 by a corresponding method accepting language ISO code instead of language ID.")] public static string? GetTranslatedValue(this IDictionaryItem d, int languageId) { IDictionaryTranslation? trans = d.Translations.FirstOrDefault(x => x.LanguageId == languageId); @@ -21,6 +22,7 @@ public static class DictionaryItemExtensions /// /// /// + [Obsolete("Warning: This method ONLY works in very specific scenarios. It will be removed in V13.")] public static string? GetDefaultValue(this IDictionaryItem d) { IDictionaryTranslation? defaultTranslation = d.Translations.FirstOrDefault(x => x.Language?.Id == 1); diff --git a/src/Umbraco.Core/Models/DictionaryTranslation.cs b/src/Umbraco.Core/Models/DictionaryTranslation.cs index 5d44768388..ab79b77e44 100644 --- a/src/Umbraco.Core/Models/DictionaryTranslation.cs +++ b/src/Umbraco.Core/Models/DictionaryTranslation.cs @@ -30,12 +30,14 @@ public class DictionaryTranslation : EntityBase, IDictionaryTranslation Key = uniqueId; } + [Obsolete("Please use constructor that accepts ILanguage. This will be removed in V13.")] public DictionaryTranslation(int languageId, string value) { LanguageId = languageId; _value = value; } + [Obsolete("Please use constructor that accepts ILanguage. This will be removed in V13.")] public DictionaryTranslation(int languageId, string value, Guid uniqueId) { LanguageId = languageId; @@ -56,6 +58,7 @@ public class DictionaryTranslation : EntityBase, IDictionaryTranslation /// returned /// on a callback. /// + [Obsolete("This will be removed in V13. From V13 onwards you should get languages by ISO code from ILanguageService.")] [DataMember] [DoNotClone] public ILanguage? Language @@ -83,6 +86,7 @@ public class DictionaryTranslation : EntityBase, IDictionaryTranslation } } + [Obsolete("This will be replaced by language ISO code in V13.")] public int LanguageId { get; private set; } /// diff --git a/src/Umbraco.Core/Models/IDictionaryTranslation.cs b/src/Umbraco.Core/Models/IDictionaryTranslation.cs index 37579151bc..45d71e3f9b 100644 --- a/src/Umbraco.Core/Models/IDictionaryTranslation.cs +++ b/src/Umbraco.Core/Models/IDictionaryTranslation.cs @@ -8,9 +8,11 @@ public interface IDictionaryTranslation : IEntity, IRememberBeingDirty /// /// Gets or sets the for the translation /// + [Obsolete("This will be removed in V13. From V13 onwards you should get languages by ISO code from ILanguageService.")] [DataMember] ILanguage? Language { get; set; } + [Obsolete("This will be replaced by language ISO code in V13.")] int LanguageId { get; } /// diff --git a/src/Umbraco.Core/Models/ILanguage.cs b/src/Umbraco.Core/Models/ILanguage.cs index 5f48bc363e..88c76ae7b0 100644 --- a/src/Umbraco.Core/Models/ILanguage.cs +++ b/src/Umbraco.Core/Models/ILanguage.cs @@ -55,6 +55,7 @@ public interface ILanguage : IEntity, IRememberBeingDirty /// define fallback strategies when a value does not exist for a requested language. /// /// + [Obsolete("This will be replaced by fallback language ISO code in V13.")] [DataMember] int? FallbackLanguageId { get; set; } } diff --git a/src/Umbraco.Core/Models/Language.cs b/src/Umbraco.Core/Models/Language.cs index 2072533917..9871cf3eed 100644 --- a/src/Umbraco.Core/Models/Language.cs +++ b/src/Umbraco.Core/Models/Language.cs @@ -74,6 +74,7 @@ public class Language : EntityBase, ILanguage } /// + [Obsolete("This will be replaced by fallback language ISO code in V13.")] public int? FallbackLanguageId { get => _fallbackLanguageId; diff --git a/tests/Umbraco.Tests.Common/Builders/LanguageBuilder.cs b/tests/Umbraco.Tests.Common/Builders/LanguageBuilder.cs index 0eaf125332..16283e0adf 100644 --- a/tests/Umbraco.Tests.Common/Builders/LanguageBuilder.cs +++ b/tests/Umbraco.Tests.Common/Builders/LanguageBuilder.cs @@ -95,6 +95,7 @@ public class LanguageBuilder return this; } + [Obsolete("This will be replaced in V13 by a corresponding method accepting language ISO code instead of language ID.")] public LanguageBuilder WithFallbackLanguageId(int fallbackLanguageId) { _fallbackLanguageId = fallbackLanguageId;