多语言逻辑

This commit is contained in:
bob
2025-06-13 17:35:29 +08:00
parent f862c7514c
commit e060f9eb02
18 changed files with 561 additions and 221 deletions

View File

@@ -47,7 +47,15 @@ namespace NBF
{
var tabData = tabList[i];
var tabItem = List.AddItemFromPool().asButton;
tabItem.title = Lan.Get(tabData.Name);
if (!string.IsNullOrEmpty(tabData.Key))
{
tabItem.SetLanguage(tabData.Key);
}
else
{
tabItem.SetLanguage(tabData.Name);
}
listWidth += tabItem.width;
if (i > 0)
{

View File

@@ -47,7 +47,7 @@ namespace NBF
{
var tabData = subItems[i];
var tabItem = List.AddItemFromPool().asButton;
tabItem.title = Lan.Get(tabData.Name);
tabItem.SetLanguage(tabData.Name);
width += tabItem.width;
if (i > 0)
{

View File

@@ -25,17 +25,17 @@ namespace NBF
{
if (string.IsNullOrEmpty(title))
{
title = Lan.Get("TEXT_NOTE");
title = "TEXT_NOTE";
}
if (string.IsNullOrEmpty(confirm))
{
confirm = Lan.Get("TEXT_CONFIRM");
confirm = "TEXT_CONFIRM";
}
if (string.IsNullOrEmpty(cancel))
{
cancel = Lan.Get("TEXT_CANCEL");
cancel = "TEXT_CANCEL";
}
_confirmText = confirm;
@@ -59,10 +59,10 @@ namespace NBF
protected override void OnShow()
{
TextTitle.text = _title;
BtnConfirm.title = _confirmText;
BtnCancel.title = _cancelText;
TextContent.text = _content;
TextTitle.SetLanguage(_title);
BtnConfirm.SetLanguage(_confirmText);
BtnCancel.SetLanguage(_cancelText);
TextContent.SetLanguage(_content);
MessageStyle.selectedIndex = _style;
}

View File

@@ -34,7 +34,7 @@ namespace NBF
Slider.wholeNumbers = true;
}
TextName.text = Lan.Get(Option.Name);
TextName.SetLanguage(Option.Name);
SetShow();
}

View File

@@ -31,7 +31,8 @@ namespace NBF
{
var tab = new TabListData
{
Name = group
Name = group,
Key = $"TEXT_SETTINGS_{group}"
};
tabList.Add(tab);
}
@@ -85,7 +86,7 @@ namespace NBF
var value = groupOptions[key];
if (List.AddItemFromPool(url) is GLabel label)
{
label.title = Lan.Get(key);
label.SetLanguage(key);
}
foreach (var option in value)
@@ -199,8 +200,8 @@ namespace NBF
var settingItem = List.GetChildAt(index);
if (settingItem is SettingItem item)
{
Introduce.TextName.text = Lan.Get(item.Option.Name);
Introduce.TextIntroduce.text = Lan.Get(item.Option.Name);
Introduce.TextName.SetLanguage(item.Option.Name);
Introduce.TextIntroduce.SetLanguage(item.Option.Name);
// Introduce.
}
}