mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-11 00:27:21 +00:00
Added the informal address to the BeyondFacts Lab (#1176)
This commit is contained in:
1 parent
b6c3fbb5db
commit
e77645f44c
48 files changed
+1254
-160
No files matched your search
@@ -0,0 +1,33 @@
|
||||
using SharedTools;
|
||||
|
||||
namespace AIStudio.Tools.PluginSystem;
|
||||
|
||||
public static class ILanguagePluginExtensions
|
||||
{
|
||||
/// <param name="plugin">The language plugin.</param>
|
||||
extension(ILanguagePlugin plugin)
|
||||
{
|
||||
/// <summary>
|
||||
/// Checks whether the language tells a formal address from an informal one, so that a choice between both
|
||||
/// makes sense.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The plugin decides by its texts, not by a list of languages: it needs an informal variant of a text of
|
||||
/// TA() which reads differently than the formal one. English addresses everybody alike, so its plugin holds
|
||||
/// the informal variants in the same words. A language translated before it got informal variants offers
|
||||
/// no choice either, since it would change nothing.
|
||||
/// </remarks>
|
||||
/// <returns>True, when at least one informal variant differs from its formal one.</returns>
|
||||
public bool HasInformalAddress()
|
||||
{
|
||||
var content = plugin.Content;
|
||||
foreach (var (key, text) in content)
|
||||
{
|
||||
if (I18NAddressVariant.TryGetFormalKey(key, out var formalKey) && content.TryGetValue(formalKey, out var formalText) && !string.Equals(text, formalText, StringComparison.Ordinal))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user