Added the informal address to the BeyondFacts Lab (#1176)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-08 21:10:51 +01:00
1 parent b6c3fbb5db
commit e77645f44c
48 files changed
+1254 -160

No files matched your search

@@ -1,5 +1,4 @@
using AIStudio.Assistants.Agenda;
using AIStudio.Assistants.BeyondFactsLab;
using AIStudio.Assistants.Coding;
using AIStudio.Assistants.IconFinder;
using AIStudio.Assistants.RewriteImprove;
@@ -331,9 +330,9 @@ public static class ConfigurationSelectDataFactory
yield return new(level.Name, level);
}
public static IEnumerable<ConfigurationSelectData<BflAddressForm>> GetBeyondFactsLabAddressFormData()
public static IEnumerable<ConfigurationSelectData<AddressForm>> GetBeyondFactsLabAddressFormData()
{
foreach (var addressForm in Enum.GetValues<BflAddressForm>())
foreach (var addressForm in Enum.GetValues<AddressForm>())
yield return new(addressForm.Name, addressForm);
}
@@ -0,0 +1,22 @@
namespace AIStudio.Settings.DataModel;
/// <summary>
/// How a text addresses the person in languages which tell a formal address from an informal one, such as German,
/// French, or Spanish.
/// </summary>
/// <remarks>
/// Only texts of TA() have both forms; see I18N.AddressForm.
/// </remarks>
public enum AddressForm
{
/// <summary>
/// The formal address, such as "Sie" in German, "vous" in French, or "usted" in Spanish. All texts of AI Studio
/// use it, unless the person chose otherwise.
/// </summary>
FORMAL,
/// <summary>
/// The informal address, such as "du" in German, "tu" in French, or "tú" in Spanish.
/// </summary>
INFORMAL,
}
@@ -0,0 +1,27 @@
using AIStudio.Tools.PluginSystem;
namespace AIStudio.Settings.DataModel;
public static class AddressFormExtensions
{
private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(AddressFormExtensions).Namespace, nameof(AddressFormExtensions));
/// <param name="addressForm">The form of address.</param>
extension(AddressForm addressForm)
{
/// <summary>
/// Gets the name of the form of address, as the settings show it.
/// </summary>
/// <remarks>
/// The settings offer the choice only in languages which have both forms, so the translations name the
/// pronoun of their language, such as "Sie" and "du" in German.
/// </remarks>
public string Name => addressForm switch
{
AddressForm.FORMAL => TB("Formal address"),
AddressForm.INFORMAL => TB("Informal address"),
_ => TB("Formal address"),
};
}
}
@@ -1,6 +1,5 @@
using System.Linq.Expressions;
using AIStudio.Assistants.BeyondFactsLab;
using AIStudio.Provider;
namespace AIStudio.Settings.DataModel;
@@ -44,7 +43,7 @@ public sealed class DataBeyondFactsLab(Expression<Func<Data, DataBeyondFactsLab>
/// <summary>
/// Gets or sets how the lab addresses the person in languages with a formal and an informal address.
/// </summary>
public BflAddressForm AddressForm { get; set; } = ManagedConfiguration.Register(configSelection, value => value.AddressForm, BflAddressForm.FORMAL);
public AddressForm AddressForm { get; set; } = ManagedConfiguration.Register(configSelection, value => value.AddressForm, AddressForm.FORMAL);
/// <summary>
/// Gets or sets the hash of the notes the person confirmed, see BflNotice; empty while they confirmed none.