using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
namespace LocalizationTool.Models
{
/// 表格行:一条中文源文 + 各语言译文单元格。
public class RowVm : INotifyPropertyChanged
{
public int Index { get; set; }
public string Key { get; set; }
/// 单元格字典,key = 语言代码(如 "en-US")。用 Dictionary 是为了支持 XAML 的 Cells[code] 字符串索引绑定。
public Dictionary Cells { get; set; } = new Dictionary();
public int MissingCount => Cells.Values.Count(c => c.IsMissing);
public string MissingText => MissingCount == 0 ? "全译" : $"缺 {MissingCount}";
public bool HasMissing => MissingCount > 0;
public event PropertyChangedEventHandler PropertyChanged;
public void Touch() => OnPropertyChanged(nameof(MissingCount));
private void OnPropertyChanged(string n) =>
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(n));
}
}