Obsolete language ID related properties and methods for V13 (#13753)

This commit is contained in:
Kenn Jacobsen
2023-02-01 09:37:43 +01:00
committed by GitHub
parent e79198c990
commit 4453459f06
8 changed files with 13 additions and 0 deletions

View File

@@ -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; }
}

View File

@@ -34,6 +34,7 @@ public class DictionaryItem : EntityBase, IDictionaryItem
_translations = new List<IDictionaryTranslation>();
}
[Obsolete("This will be removed in V13.")]
public Func<int, ILanguage?>? GetLanguage { get; set; }
/// <summary>

View File

@@ -10,6 +10,7 @@ public static class DictionaryItemExtensions
/// <param name="d"></param>
/// <param name="languageId"></param>
/// <returns></returns>
[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
/// </summary>
/// <param name="d"></param>
/// <returns></returns>
[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);

View File

@@ -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.
/// </remarks>
[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; }
/// <summary>

View File

@@ -8,9 +8,11 @@ public interface IDictionaryTranslation : IEntity, IRememberBeingDirty
/// <summary>
/// Gets or sets the <see cref="Language" /> for the translation
/// </summary>
[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; }
/// <summary>

View File

@@ -55,6 +55,7 @@ public interface ILanguage : IEntity, IRememberBeingDirty
/// define fallback strategies when a value does not exist for a requested language.
/// </para>
/// </remarks>
[Obsolete("This will be replaced by fallback language ISO code in V13.")]
[DataMember]
int? FallbackLanguageId { get; set; }
}

View File

@@ -74,6 +74,7 @@ public class Language : EntityBase, ILanguage
}
/// <inheritdoc />
[Obsolete("This will be replaced by fallback language ISO code in V13.")]
public int? FallbackLanguageId
{
get => _fallbackLanguageId;

View File

@@ -95,6 +95,7 @@ public class LanguageBuilder<TParent>
return this;
}
[Obsolete("This will be replaced in V13 by a corresponding method accepting language ISO code instead of language ID.")]
public LanguageBuilder<TParent> WithFallbackLanguageId(int fallbackLanguageId)
{
_fallbackLanguageId = fallbackLanguageId;