using Content.Shared.Atmos; using Content.Shared.Atmos.Prototypes; using Content.Shared.Chemistry.Reagent; using Content.Shared.Localizations; using Robust.Shared.Prototypes; namespace Content.Shared.Botany.PlantAnalyzer; public sealed class PlantAnalyzerLocalizationHelper : EntitySystem { [Dependency] private readonly IPrototypeManager _prototypeManager = default!; public string GasesToLocalizedStrings(List gases) { if (gases.Count == 0) return ""; List gasIds = []; foreach (var gas in gases) gasIds.Add((int)gas); List gasesLoc = []; foreach (var gas in _prototypeManager.EnumeratePrototypes()) if (gasIds.Contains(int.Parse(gas.ID))) gasesLoc.Add(Loc.GetString(gas.Name)); return ContentLocalizationManager.FormatList(gasesLoc); } public string ChemicalsToLocalizedStrings(List ids) { if (ids.Count == 0) return ""; List locStrings = []; foreach (var id in ids) locStrings.Add(_prototypeManager.TryIndex(id, out var prototype) ? prototype.LocalizedName : id); return ContentLocalizationManager.FormatList(locStrings); } public (string Singular, string Plural, string First) ProduceToLocalizedStrings(List ids) { if (ids.Count == 0) return ("", "", ""); List singularStrings = []; List pluralStrings = []; foreach (var id in ids) { var singular = _prototypeManager.TryIndex(id, out var prototype) ? prototype.Name : id.Id; var plural = Loc.GetString("plant-analyzer-produce-plural", ("thing", singular)); singularStrings.Add(singular); pluralStrings.Add(plural); } return ( ContentLocalizationManager.FormatListToOr(singularStrings), ContentLocalizationManager.FormatListToOr(pluralStrings), singularStrings[0] ); } }