Implement people management features by adding API endpoints for retrieving school rosters and individual person cards. Enhance the UI to support a people browser with filtering and pagination capabilities. Update localization strings for improved user experience and ensure robust handling of person data. Revise documentation to reflect new API functionalities and update tests to validate the new features.
This commit is contained in:
@@ -112,11 +112,10 @@ public sealed class DefCatalog
|
||||
/// <summary>Locale string for a def, walking <c>parent</c> when the key is missing. Falls back to <c>defName</c>.</summary>
|
||||
public string Label(string locale, Def def)
|
||||
{
|
||||
var table = locale.Equals("en", StringComparison.OrdinalIgnoreCase) ? _en : _ru;
|
||||
var current = def;
|
||||
while (true)
|
||||
{
|
||||
if (table.TryGetValue(current.DefName, out var label))
|
||||
if (TryText(locale, current.DefName, out var label))
|
||||
{
|
||||
return label;
|
||||
}
|
||||
@@ -130,6 +129,18 @@ public sealed class DefCatalog
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raw locale lookup for keys that are not defs — body-build bands, hair colours, and so on.
|
||||
/// Missing keys fall back to <paramref name="key"/> so a card never goes blank.
|
||||
/// </summary>
|
||||
public string Text(string locale, string key) => TryText(locale, key, out var text) ? text : key;
|
||||
|
||||
private bool TryText(string locale, string key, out string text)
|
||||
{
|
||||
var table = locale.Equals("en", StringComparison.OrdinalIgnoreCase) ? _en : _ru;
|
||||
return table.TryGetValue(key, out text!);
|
||||
}
|
||||
|
||||
internal static DefKind KindOf(Def def) => def switch
|
||||
{
|
||||
ActionDef => DefKind.Action,
|
||||
|
||||
Reference in New Issue
Block a user