From 3fc42e45d790142cec36584bb76885d99c90ca15 Mon Sep 17 00:00:00 2001 From: Kerbas-ad-astra Date: Mon, 16 Mar 2020 09:28:03 -0400 Subject: [PATCH 1/2] Starting to internationalize --- src/achievements/Achievement.cs | 54 ++++++++++++++++----------------- src/achievements/RibbonPool.cs | 2 +- src/util/Extensions.cs | 4 +-- src/util/Utils.cs | 2 +- src/window/DisplayWindow.cs | 2 +- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/achievements/Achievement.cs b/src/achievements/Achievement.cs index 5aac1a5..e025dd1 100644 --- a/src/achievements/Achievement.cs +++ b/src/achievements/Achievement.cs @@ -502,14 +502,14 @@ public override String GetDescription() { return "Awarded for being the first kerbal in space"; } - return "Awarded for leaving " + GameUtils.GetHomeworld().name + "'s atmosphere"; + return "Awarded for leaving " + GameUtils.GetHomeworld().displayName + "'s atmosphere"; } } class EnteringAtmosphereAchievement : CelestialBodyAchievement { public EnteringAtmosphereAchievement(CelestialBody body,int prestige, bool first = false) - : base("A", body.GetName()+" Atmosphere", body, prestige, first) + : base("A", body.GetDisplayName()+" Atmosphere", body, prestige, first) { } @@ -530,7 +530,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for" + FirstKerbalText().Envelope() + "entering the atmosphere of " + body.GetName(); + return "Awarded for" + FirstKerbalText().Envelope() + "entering the atmosphere of " + body.GetDisplayName(); } } @@ -541,7 +541,7 @@ abstract class CelestialBodyAchievement : Achievement protected CelestialBody body; public CelestialBodyAchievement(String code, String name, CelestialBody body, int prestige, bool first = false) - : base(code+(first?"1:":":") + body.GetName(), name, prestige, first) + : base(code+(first?"1:":":") + body.GetName(), name, prestige, first) // Do not localize this GetName call, it's an internal identifier { this.body = body; } @@ -619,7 +619,7 @@ class SphereOfInfluenceAchievement : CelestialBodyAchievement { public SphereOfInfluenceAchievement(CelestialBody body, int prestige) - : base("I", body.GetName() + " Sphere of Influence", body, prestige, false) + : base("I", body.GetDisplayName() + " Sphere of Influence", body, prestige, false) { } @@ -633,14 +633,14 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for entering the sphere of influence of " + body.GetName(); + return "Awarded for entering the sphere of influence of " + body.GetDisplayName(); } } class LandingAchievement : CelestialBodyAchievement { public LandingAchievement(CelestialBody body, int prestige, bool first = false) - : base("L", "Landing on " + body.GetName(), body, prestige, first) + : base("L", "Landing on " + body.GetDisplayName(), body, prestige, first) { } @@ -662,7 +662,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for" + FirstKerbalText().Envelope() + "landing on " + body.GetName(); + return "Awarded for" + FirstKerbalText().Envelope() + "landing on " + body.GetDisplayName(); } } @@ -670,7 +670,7 @@ public override String GetDescription() class PlantFlagAchievement : CelestialBodyAchievement { public PlantFlagAchievement(CelestialBody body, int prestige, bool first = false) - : base("F", "Flag on " + body.GetName(), body, prestige, first) + : base("F", "Flag on " + body.GetDisplayName(), body, prestige, first) { } @@ -685,7 +685,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for" + FirstKerbalText().Envelope() + "planting a flag on " + body.GetName(); + return "Awarded for" + FirstKerbalText().Envelope() + "planting a flag on " + body.GetDisplayName(); } } @@ -694,7 +694,7 @@ class EvaAchievement : CelestialBodyAchievement private static readonly double NO_ATM = 0.0000001; public EvaAchievement(CelestialBody body, int prestige, bool first = false) - : base("V", body.GetName() + " EVA", body, prestige, first) + : base("V", body.GetDisplayName() + " EVA", body, prestige, first) { } @@ -719,7 +719,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for" + FirstKerbalText().Envelope() + "on EVA in zero atmosphere around " + body.GetName(); + return "Awarded for" + FirstKerbalText().Envelope() + "on EVA in zero atmosphere around " + body.GetDisplayName(); } } @@ -759,7 +759,7 @@ class EvaOrbitAchievement : CelestialBodyAchievement private static readonly double NO_ATM = 0.0000001; public EvaOrbitAchievement(CelestialBody body, int prestige, bool first = false) - : base("E", body.GetName() + " Orbital EVA", body, prestige, first) + : base("E", body.GetDisplayName() + " Orbital EVA", body, prestige, first) { } @@ -776,7 +776,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for" + FirstKerbalText().Envelope() + "on EVA in a stable orbit around " + body.GetName(); + return "Awarded for" + FirstKerbalText().Envelope() + "on EVA in a stable orbit around " + body.GetDisplayName(); } } @@ -784,7 +784,7 @@ public override String GetDescription() class EvaGroundAchievement : CelestialBodyAchievement { public EvaGroundAchievement(CelestialBody body, int prestige, bool first = false) - : base("G", body.GetName()+" Surface EVA", body, prestige, first) + : base("G", body.GetDisplayName()+" Surface EVA", body, prestige, first) { } @@ -804,7 +804,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for" + FirstKerbalText().Envelope() + "taking footsteps on " + body.GetName(); + return "Awarded for" + FirstKerbalText().Envelope() + "taking footsteps on " + body.GetDisplayName(); } } @@ -826,7 +826,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre class OrbitAchievement : OrbitalAchievement { public OrbitAchievement(CelestialBody body, int prestige, bool first = false) - : base("O", body.GetName()+" Orbit", body, prestige, first) + : base("O", body.GetDisplayName()+" Orbit", body, prestige, first) { } @@ -839,7 +839,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for" + FirstKerbalText().Envelope() + "orbiting around " + body.GetName(); + return "Awarded for" + FirstKerbalText().Envelope() + "orbiting around " + body.GetDisplayName(); } } @@ -847,7 +847,7 @@ class RoverAchievement : CelestialBodyAchievement { public RoverAchievement(CelestialBody body, int prestige, bool first = false) - : base("R", body.GetName() + " Rover Drive", body, prestige, first) + : base("R", body.GetDisplayName() + " Rover Drive", body, prestige, first) { } @@ -862,7 +862,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for" + FirstKerbalText().Envelope() + "moving a vehicle on surface of " + body.GetName(); + return "Awarded for" + FirstKerbalText().Envelope() + "moving a vehicle on surface of " + body.GetDisplayName(); } } @@ -889,7 +889,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for" + FirstKerbalText().Envelope() + "orbiting " + base.body.GetName() + " half between periapse of " + innermost.GetName() + " and " + base.body.GetName(); + return "Awarded for" + FirstKerbalText().Envelope() + "orbiting " + base.body.GetDisplayName() + " half between periapse of " + innermost.GetDisplayName() + " and " + base.body.GetDisplayName(); } } @@ -897,7 +897,7 @@ public override String GetDescription() class DockingAchievement : OrbitalAchievement { public DockingAchievement(CelestialBody body, int prestige, bool first = false) - : base("DO", body.GetName()+" Docking", body, prestige, first) + : base("DO", body.GetDisplayName()+" Docking", body, prestige, first) { } @@ -911,7 +911,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for" + FirstKerbalText().Envelope() + "docking in " + body.GetName()+" orbit"; + return "Awarded for" + FirstKerbalText().Envelope() + "docking in " + body.GetDisplayName()+" orbit"; } } @@ -1047,7 +1047,7 @@ class DeepAtmosphereArchievement : CelestialBodyAchievement { public DeepAtmosphereArchievement(CelestialBody body, int prestige) - : base("DA",body.GetName() + " Deep Atmosphere",body, prestige, false) + : base("DA",body.GetDisplayName() + " Deep Atmosphere",body, prestige, false) { } @@ -1060,7 +1060,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for entering the deeper atmosphere of " + body.GetName(); + return "Awarded for entering the deeper atmosphere of " + body.GetDisplayName(); } } @@ -1137,7 +1137,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { if (outermostBodyInSystem == null) return "no outermost planet found in system (ribbon not used)"; - return "Awarded for" + FirstKerbalText().Envelope() + "in space beyond the sphere of influence of " + outermostBodyInSystem.name; + return "Awarded for" + FirstKerbalText().Envelope() + "in space beyond the sphere of influence of " + outermostBodyInSystem.displayName; } } @@ -1355,7 +1355,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for any EVA in " + GameUtils.GetHomeworld().name + "'s waters"; + return "Awarded for any EVA in " + GameUtils.GetHomeworld().displayName + "'s waters"; } } diff --git a/src/achievements/RibbonPool.cs b/src/achievements/RibbonPool.cs index a2f8ecc..b2bd027 100644 --- a/src/achievements/RibbonPool.cs +++ b/src/achievements/RibbonPool.cs @@ -118,7 +118,7 @@ private void CreateRibbons() // foreach (CelestialBody body in PSystemManager.Instance.localBodies) { - string bodyName = body.GetName(); + string bodyName = body.GetName(); // Leave this unlocalized, this is an internal identifier (otherwise we'd have to localize all of the ribbon folders) int basePrestige = mapper.GetBasePrestige(body); String BODY_RIBBON_PATH = mapper.GetRibbonPath(body, _RP)+bodyName; diff --git a/src/util/Extensions.cs b/src/util/Extensions.cs index 14ae216..50de65b 100644 --- a/src/util/Extensions.cs +++ b/src/util/Extensions.cs @@ -193,7 +193,7 @@ public static Vessel GetVessel(this ProtoCrewMember kerbal) public static int BasePrestige(this CelestialBody body) { - switch (body.GetName()) + switch (body.GetName()) // Leave this as the unlocalized name, this is for the internal identifier of the planet { case "Kerbin": return 1000; case "Mun": return 1200; @@ -212,7 +212,7 @@ public static int BasePrestige(this CelestialBody body) case "Laythe": return 7000; case "Eeloo": return 8000; case "Sun": return 9000; - default: Log.Warning("no base prestige for celestial body " + body.GetName()); + default: Log.Warning("no base prestige for celestial body " + body.GetName()); // Likewise here return 99000; } } diff --git a/src/util/Utils.cs b/src/util/Utils.cs index aedc1ad..8cca23a 100644 --- a/src/util/Utils.cs +++ b/src/util/Utils.cs @@ -70,7 +70,7 @@ public static CelestialBody GetCelestialBody(String name) { foreach (CelestialBody body in PSystemManager.Instance.localBodies) { - if (body.GetName().Equals(name)) return body; + if (body.GetName().Equals(name)) return body; // Do not localize this GetName call, it's supposed to be the internal representation. } return null; } diff --git a/src/window/DisplayWindow.cs b/src/window/DisplayWindow.cs index 1b477b8..d596dbe 100644 --- a/src/window/DisplayWindow.cs +++ b/src/window/DisplayWindow.cs @@ -522,7 +522,7 @@ private void DrawLocation(ProtoCrewMember kerbal) } else if(vessel!=null) { - location = vessel.mainBody.GetName(); + location = vessel.mainBody.GetDisplayName(); } else { From ad9c9168abd5d23da81fea9595ad948473f70b54 Mon Sep 17 00:00:00 2001 From: Kerbas-ad-astra Date: Mon, 16 Mar 2020 11:44:22 -0400 Subject: [PATCH 2/2] Finished this first round of internationalization. Alternate homeworld names now fully supported. --- Localization/en-us.cfg | 48 ++++++++++++++++++++++++++++ src/achievements/Achievement.cs | 55 +++++++++++++++++---------------- src/window/DisplayWindow.cs | 3 +- 3 files changed, 78 insertions(+), 28 deletions(-) create mode 100644 Localization/en-us.cfg diff --git a/Localization/en-us.cfg b/Localization/en-us.cfg new file mode 100644 index 0000000..f8f1461 --- /dev/null +++ b/Localization/en-us.cfg @@ -0,0 +1,48 @@ +Localization +{ + en-us + { + #FF_Achievement_FirstKerbalText = being the first kerbal + + #FF_Achievement_EnteringAtmosphereAchievement_name = <<1>> Atmosphere + #FF_Achievement_EnteringAtmosphereAchievement_desc = Awarded for<<1>>entering the atmosphere of <<2>> + + #FF_Achievement_SphereOfInfluenceAchievement_name = <<1>> Sphere of Influence + #FF_Achievement_SphereOfInfluenceAchievement_desc = Awarded for entering the sphere of influence of <<1>> + + #FF_Achievement_LandingAchievement_name = Landing on <<1>> + #FF_Achievement_LandingAchievement_desc = Awarded for<<1>>landing on <<2>> + + #FF_Achievement_PlantFlagAchievement_name = Flag on <<1>> + #FF_Achievement_PlantFlagAchievement_desc = Awarded for<<1>>planting a flag on <<2>> + + #FF_Achievement_EvaAchievement_name = <<1>> EVA + #FF_Achievement_EvaAchievement_desc = Awarded for<<1>>going on EVA in zero atmosphere around <<2>> + + #FF_Achievement_EvaOrbitAchievement_name = <<1>> Orbital EVA + #FF_Achievement_EvaOrbitAchievement_desc = Awarded for<<1>>going on EVA in a stable orbit around <<2>> + + #FF_Achievement_EvaGroundAchievement_name = <<1>> Surface EVA + #FF_Achievement_EvaGroundAchievement_desc = Awarded for<<1>>taking footsteps on <<2>> + + #FF_Achievement_OrbitAchievement_name = <<1>> Orbit + #FF_Achievement_OrbitAchievement_desc = Awarded for<<1>>orbiting around <<2>> + + #FF_Achievement_RoverAchievement_name = <<1>> Rover Drive + #FF_Achievement_RoverAchievement_desc = Awarded for<<1>>moving a vehicle on the surface of <<2>> + + #FF_Achievement_CloserSolarOrbitAchievement_desc = Awarded for<<1>>orbiting <<2>> closer than half the periapsis of <<3>> + + #FF_Achievement_DockingAchievement_name = <<1>> Docking + #FF_Achievement_DockingAchievement_desc = Awarded for<<1>>docking in <<2>> orbit + + #FF_Achievement_DeepAtmosphereAchievement_name = <<1>> Deep Atmosphere + #FF_Achievement_DeepAtmosphereAchievement_desc = Awarded for entering the deeper atmosphere of <<1>> + + #FF_Achievement_DeepSpaceAchievement_desc = Awarded for<<1>>flying in deep space beyond the sphere of influence of <<2>> + + #FF_Achievement_PolarLandingAchievement_desc = + + #FF_Achievement_LowGravityLandingAchievement_desc = Awarded for<<1>>landing in the <<2>> polar region of <<3>> + } +} diff --git a/src/achievements/Achievement.cs b/src/achievements/Achievement.cs index e025dd1..3118fb0 100644 --- a/src/achievements/Achievement.cs +++ b/src/achievements/Achievement.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using UnityEngine; using Contracts; +using KSP.Localization; namespace Nereid { @@ -156,7 +157,7 @@ public bool HasToBeFirst() protected String FirstKerbalText() { - return first ? "being first kerbal" : ""; + return first ? Localizer.Format("#FF_Achievement_FirstKerbalText") : ""; } public int CompareTo(Achievement right) @@ -509,7 +510,7 @@ public override String GetDescription() class EnteringAtmosphereAchievement : CelestialBodyAchievement { public EnteringAtmosphereAchievement(CelestialBody body,int prestige, bool first = false) - : base("A", body.GetDisplayName()+" Atmosphere", body, prestige, first) + : base("A", Localizer.Format("#FF_Achievement_EnteringAtmosphereAchievement_name",body.GetDisplayName()), body, prestige, first) { } @@ -530,7 +531,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for" + FirstKerbalText().Envelope() + "entering the atmosphere of " + body.GetDisplayName(); + return Localizer.Format("#FF_Achievement_EnteringAtmosphereAchievement_name", FirstKerbalText().Envelope(), body.GetDisplayName()); } } @@ -619,7 +620,7 @@ class SphereOfInfluenceAchievement : CelestialBodyAchievement { public SphereOfInfluenceAchievement(CelestialBody body, int prestige) - : base("I", body.GetDisplayName() + " Sphere of Influence", body, prestige, false) + : base("I", Localizer.Format("#FF_Achievement_SphereOfInfluenceAchievement_name", body.GetDisplayName()), body, prestige, false) { } @@ -633,14 +634,14 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for entering the sphere of influence of " + body.GetDisplayName(); + return Localizer.Format("#FF_Achievement_SphereOfInfluenceAchievement_desc", body.GetDisplayName()); } } class LandingAchievement : CelestialBodyAchievement { public LandingAchievement(CelestialBody body, int prestige, bool first = false) - : base("L", "Landing on " + body.GetDisplayName(), body, prestige, first) + : base("L", Localizer.Format("#FF_Achievement_LandingAchievement_name",body.GetDisplayName()), body, prestige, first) { } @@ -662,7 +663,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for" + FirstKerbalText().Envelope() + "landing on " + body.GetDisplayName(); + return Localizer.Format("#FF_Achievement_LandingAchievement_desc", FirstKerbalText().Envelope(), body.GetDisplayName()); } } @@ -670,7 +671,7 @@ public override String GetDescription() class PlantFlagAchievement : CelestialBodyAchievement { public PlantFlagAchievement(CelestialBody body, int prestige, bool first = false) - : base("F", "Flag on " + body.GetDisplayName(), body, prestige, first) + : base("F", Localizer.Format("#FF_Achievement_PlantFlagAchievement_name", body.GetDisplayName()), body, prestige, first) { } @@ -685,7 +686,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for" + FirstKerbalText().Envelope() + "planting a flag on " + body.GetDisplayName(); + return Localizer.Format("#FF_Achievement_PlantFlagAchievement_desc", FirstKerbalText().Envelope(), body.GetDisplayName()); } } @@ -694,7 +695,7 @@ class EvaAchievement : CelestialBodyAchievement private static readonly double NO_ATM = 0.0000001; public EvaAchievement(CelestialBody body, int prestige, bool first = false) - : base("V", body.GetDisplayName() + " EVA", body, prestige, first) + : base("V", Localizer.Format("#FF_Achievement_EvaAchievement_name", body.GetDisplayName()), body, prestige, first) { } @@ -719,7 +720,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for" + FirstKerbalText().Envelope() + "on EVA in zero atmosphere around " + body.GetDisplayName(); + return Localizer.Format("#FF_Achievement_EvaAchievement_desc", FirstKerbalText().Envelope(), body.GetDisplayName()); } } @@ -759,7 +760,7 @@ class EvaOrbitAchievement : CelestialBodyAchievement private static readonly double NO_ATM = 0.0000001; public EvaOrbitAchievement(CelestialBody body, int prestige, bool first = false) - : base("E", body.GetDisplayName() + " Orbital EVA", body, prestige, first) + : base("E", Localizer.Format("#FF_Achievement_EvaOrbitAchievement_name", body.GetDisplayName()), body, prestige, first) { } @@ -776,7 +777,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for" + FirstKerbalText().Envelope() + "on EVA in a stable orbit around " + body.GetDisplayName(); + return Localizer.Format("#FF_Achievement_EvaOrbitAchievement_desc", FirstKerbalText().Envelope(), body.GetDisplayName()); } } @@ -784,7 +785,7 @@ public override String GetDescription() class EvaGroundAchievement : CelestialBodyAchievement { public EvaGroundAchievement(CelestialBody body, int prestige, bool first = false) - : base("G", body.GetDisplayName()+" Surface EVA", body, prestige, first) + : base("G", Localizer.Format("#FF_Achievement_EvaGroundAchievement_name", body.GetDisplayName()), body, prestige, first) { } @@ -804,7 +805,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for" + FirstKerbalText().Envelope() + "taking footsteps on " + body.GetDisplayName(); + return Localizer.Format("#FF_Achievement_EvaGroundAchievement_desc", FirstKerbalText().Envelope(), body.GetDisplayName()); } } @@ -826,7 +827,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre class OrbitAchievement : OrbitalAchievement { public OrbitAchievement(CelestialBody body, int prestige, bool first = false) - : base("O", body.GetDisplayName()+" Orbit", body, prestige, first) + : base("O", Localizer.Format("#FF_Achievement_EvaGroundAchievement_name", body.GetDisplayName()), body, prestige, first) { } @@ -839,7 +840,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for" + FirstKerbalText().Envelope() + "orbiting around " + body.GetDisplayName(); + return Localizer.Format("#FF_Achievement_OrbitAchievement_desc", FirstKerbalText().Envelope(), body.GetDisplayName()); } } @@ -847,7 +848,7 @@ class RoverAchievement : CelestialBodyAchievement { public RoverAchievement(CelestialBody body, int prestige, bool first = false) - : base("R", body.GetDisplayName() + " Rover Drive", body, prestige, first) + : base("R", Localizer.Format("#FF_Achievement_EvaGroundAchievement_name", body.GetDisplayName()), body, prestige, first) { } @@ -862,7 +863,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for" + FirstKerbalText().Envelope() + "moving a vehicle on surface of " + body.GetDisplayName(); + return Localizer.Format("#FF_Achievement_RoverAchievement_desc", FirstKerbalText().Envelope(), body.GetDisplayName()); } } @@ -889,7 +890,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for" + FirstKerbalText().Envelope() + "orbiting " + base.body.GetDisplayName() + " half between periapse of " + innermost.GetDisplayName() + " and " + base.body.GetDisplayName(); + return Localizer.Format("#FF_Achievement_CloserSolarOrbitAchievement_desc", FirstKerbalText().Envelope(), base.body.GetDisplayName(), innermost.GetDisplayName()); } } @@ -897,7 +898,7 @@ public override String GetDescription() class DockingAchievement : OrbitalAchievement { public DockingAchievement(CelestialBody body, int prestige, bool first = false) - : base("DO", body.GetDisplayName()+" Docking", body, prestige, first) + : base("DO", Localizer.Format("#FF_Achievement_DockingAchievement_name", body.GetDisplayName()), body, prestige, first) { } @@ -911,7 +912,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for" + FirstKerbalText().Envelope() + "docking in " + body.GetDisplayName()+" orbit"; + return Localizer.Format("#FF_Achievement_DockingAchievement_desc", FirstKerbalText().Envelope(), body.GetDisplayName()); } } @@ -1047,7 +1048,7 @@ class DeepAtmosphereArchievement : CelestialBodyAchievement { public DeepAtmosphereArchievement(CelestialBody body, int prestige) - : base("DA",body.GetDisplayName() + " Deep Atmosphere",body, prestige, false) + : base("DA", Localizer.Format("#FF_Achievement_DeepAtmosphereAchievement_name", body.GetDisplayName()), body, prestige, false) { } @@ -1060,7 +1061,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for entering the deeper atmosphere of " + body.GetDisplayName(); + return Localizer.Format("#FF_Achievement_DockingAchievement_desc", body.GetDisplayName()); } } @@ -1137,7 +1138,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { if (outermostBodyInSystem == null) return "no outermost planet found in system (ribbon not used)"; - return "Awarded for" + FirstKerbalText().Envelope() + "in space beyond the sphere of influence of " + outermostBodyInSystem.displayName; + return Localizer.Format("#FF_Achievement_DockingAchievement_desc", FirstKerbalText().Envelope(), outermostBodyInSystem.GetDisplayName()); } } @@ -1700,7 +1701,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for "+ FirstKerbalText().Envelope() + "landing in the "+hemisphere.ToLower()+" polar region of " + GameUtils.GetHomeworld().name; + return Localizer.Format("#FF_Achievement_DockingAchievement_desc", FirstKerbalText().Envelope(), hemisphere.ToLower(), GameUtils.GetHomeworld().GetDisplayName()); } } @@ -1739,7 +1740,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre public override String GetDescription() { - return "Awarded for landing in a gravity field of less than " + percent.ToString("0") + " percent of "+homeworld.name; + return Localizer.Format("#FF_Achievement_DockingAchievement_desc", percent.ToString("0"), homeworld.GetDisplayName()); } } diff --git a/src/window/DisplayWindow.cs b/src/window/DisplayWindow.cs index d596dbe..616e3d4 100644 --- a/src/window/DisplayWindow.cs +++ b/src/window/DisplayWindow.cs @@ -1,6 +1,7 @@ using System; using UnityEngine; using System.Collections.Generic; +using KSP.Localization; namespace Nereid { @@ -522,7 +523,7 @@ private void DrawLocation(ProtoCrewMember kerbal) } else if(vessel!=null) { - location = vessel.mainBody.GetDisplayName(); + location = Localizer.Format(vessel.mainBody.GetDisplayName()); } else {