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 { public static string GasesToLocalizedStrings(List gases, IPrototypeManager protMan) { if (gases.Count == 0) return ""; List gasIds = []; foreach (var gas in gases) gasIds.Add((int)gas); List gasesLoc = []; foreach (var gas in protMan.EnumeratePrototypes()) if (gasIds.Contains(int.Parse(gas.ID))) gasesLoc.Add(Loc.GetString(gas.Name)); return ContentLocalizationManager.FormatList(gasesLoc); } public static string ChemicalsToLocalizedStrings(List ids, IPrototypeManager protMan) { if (ids.Count == 0) return ""; List locStrings = []; foreach (var id in ids) locStrings.Add(protMan.TryIndex(id, out var prototype) ? prototype.LocalizedName : id); return ContentLocalizationManager.FormatList(locStrings); } public static (string Singular, string Plural) ProduceToLocalizedStrings(List ids, IPrototypeManager protMan) { if (ids.Count == 0) return ("", ""); List singularStrings = []; List pluralStrings = []; foreach (var id in ids) { var singular = protMan.TryIndex(id, out var prototype) ? prototype.Name : id; var plural = Loc.GetString("plant-analyzer-produce-plural", ("thing", singular)); singularStrings.Add(singular); pluralStrings.Add(plural); } return ( ContentLocalizationManager.FormatListToOr(singularStrings), ContentLocalizationManager.FormatListToOr(pluralStrings) ); } }