AquaDX/AquaMai.Config/Attributes/ConfigComment.cs
凌莞~(=^▽^=) 5996c4072b
[+] config entry names (#68)
* [+] config entry names

* [O] make it not so break

* fix
2025-10-03 21:56:36 +08:00

27 lines
782 B
C#

using System;
using System.Collections.Generic;
using AquaMai.Config.Interfaces;
namespace AquaMai.Config.Attributes;
public record ConfigComment(string CommentEn, string CommentZh, string NameZh) : IConfigComment
{
public string GetLocalized(string lang)
{
switch (lang)
{
case "en":
return CommentEn ?? "";
case "zh":
List<string> lines = new();
if (!string.IsNullOrEmpty(NameZh))
lines.Add(NameZh);
if (!string.IsNullOrEmpty(CommentZh))
lines.Add(CommentZh);
return string.Join("\n", lines);
default:
throw new ArgumentException($"Unsupported language: {lang}");
}
}
}