Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions Localization/en-us.cfg
Original file line number Diff line number Diff line change
@@ -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>>
}
}
61 changes: 31 additions & 30 deletions src/achievements/Achievement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using Contracts;
using KSP.Localization;

namespace Nereid
{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -502,14 +503,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", Localizer.Format("#FF_Achievement_EnteringAtmosphereAchievement_name",body.GetDisplayName()), body, prestige, first)
{
}

Expand All @@ -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.GetName();
return Localizer.Format("#FF_Achievement_EnteringAtmosphereAchievement_name", FirstKerbalText().Envelope(), body.GetDisplayName());
}

}
Expand All @@ -541,7 +542,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;
}
Expand Down Expand Up @@ -619,7 +620,7 @@ class SphereOfInfluenceAchievement : CelestialBodyAchievement
{

public SphereOfInfluenceAchievement(CelestialBody body, int prestige)
: base("I", body.GetName() + " Sphere of Influence", body, prestige, false)
: base("I", Localizer.Format("#FF_Achievement_SphereOfInfluenceAchievement_name", body.GetDisplayName()), body, prestige, false)
{
}

Expand All @@ -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.GetName();
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.GetName(), body, prestige, first)
: base("L", Localizer.Format("#FF_Achievement_LandingAchievement_name",body.GetDisplayName()), body, prestige, first)
{
}

Expand All @@ -662,15 +663,15 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre

public override String GetDescription()
{
return "Awarded for" + FirstKerbalText().Envelope() + "landing on " + body.GetName();
return Localizer.Format("#FF_Achievement_LandingAchievement_desc", FirstKerbalText().Envelope(), body.GetDisplayName());
}
}


class PlantFlagAchievement : CelestialBodyAchievement
{
public PlantFlagAchievement(CelestialBody body, int prestige, bool first = false)
: base("F", "Flag on " + body.GetName(), body, prestige, first)
: base("F", Localizer.Format("#FF_Achievement_PlantFlagAchievement_name", body.GetDisplayName()), body, prestige, first)
{
}

Expand All @@ -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.GetName();
return Localizer.Format("#FF_Achievement_PlantFlagAchievement_desc", FirstKerbalText().Envelope(), body.GetDisplayName());
}
}

Expand All @@ -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.GetName() + " EVA", body, prestige, first)
: base("V", Localizer.Format("#FF_Achievement_EvaAchievement_name", body.GetDisplayName()), body, prestige, first)
{
}

Expand All @@ -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.GetName();
return Localizer.Format("#FF_Achievement_EvaAchievement_desc", FirstKerbalText().Envelope(), body.GetDisplayName());
}
}

Expand Down Expand Up @@ -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.GetName() + " Orbital EVA", body, prestige, first)
: base("E", Localizer.Format("#FF_Achievement_EvaOrbitAchievement_name", body.GetDisplayName()), body, prestige, first)
{
}

Expand All @@ -776,15 +777,15 @@ 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 Localizer.Format("#FF_Achievement_EvaOrbitAchievement_desc", FirstKerbalText().Envelope(), body.GetDisplayName());
}
}


class EvaGroundAchievement : CelestialBodyAchievement
{
public EvaGroundAchievement(CelestialBody body, int prestige, bool first = false)
: base("G", body.GetName()+" Surface EVA", body, prestige, first)
: base("G", Localizer.Format("#FF_Achievement_EvaGroundAchievement_name", body.GetDisplayName()), body, prestige, first)
{
}

Expand All @@ -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.GetName();
return Localizer.Format("#FF_Achievement_EvaGroundAchievement_desc", FirstKerbalText().Envelope(), body.GetDisplayName());
}
}

Expand All @@ -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.GetName()+" Orbit", body, prestige, first)
: base("O", Localizer.Format("#FF_Achievement_EvaGroundAchievement_name", body.GetDisplayName()), body, prestige, first)
{
}

Expand All @@ -839,15 +840,15 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre

public override String GetDescription()
{
return "Awarded for" + FirstKerbalText().Envelope() + "orbiting around " + body.GetName();
return Localizer.Format("#FF_Achievement_OrbitAchievement_desc", FirstKerbalText().Envelope(), body.GetDisplayName());
}
}

class RoverAchievement : CelestialBodyAchievement
{

public RoverAchievement(CelestialBody body, int prestige, bool first = false)
: base("R", body.GetName() + " Rover Drive", body, prestige, first)
: base("R", Localizer.Format("#FF_Achievement_EvaGroundAchievement_name", body.GetDisplayName()), body, prestige, first)
{
}

Expand All @@ -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.GetName();
return Localizer.Format("#FF_Achievement_RoverAchievement_desc", FirstKerbalText().Envelope(), body.GetDisplayName());
}
}

Expand All @@ -889,15 +890,15 @@ 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 Localizer.Format("#FF_Achievement_CloserSolarOrbitAchievement_desc", FirstKerbalText().Envelope(), base.body.GetDisplayName(), innermost.GetDisplayName());
}
}


class DockingAchievement : OrbitalAchievement
{
public DockingAchievement(CelestialBody body, int prestige, bool first = false)
: base("DO", body.GetName()+" Docking", body, prestige, first)
: base("DO", Localizer.Format("#FF_Achievement_DockingAchievement_name", body.GetDisplayName()), body, prestige, first)
{
}

Expand All @@ -911,7 +912,7 @@ protected override bool CheckVesselState(VesselState previous, VesselState curre

public override String GetDescription()
{
return "Awarded for" + FirstKerbalText().Envelope() + "docking in " + body.GetName()+" orbit";
return Localizer.Format("#FF_Achievement_DockingAchievement_desc", FirstKerbalText().Envelope(), body.GetDisplayName());
}
}

Expand Down Expand Up @@ -1047,7 +1048,7 @@ class DeepAtmosphereArchievement : CelestialBodyAchievement
{

public DeepAtmosphereArchievement(CelestialBody body, int prestige)
: base("DA",body.GetName() + " Deep Atmosphere",body, prestige, false)
: base("DA", Localizer.Format("#FF_Achievement_DeepAtmosphereAchievement_name", body.GetDisplayName()), body, prestige, false)
{
}

Expand All @@ -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.GetName();
return Localizer.Format("#FF_Achievement_DockingAchievement_desc", body.GetDisplayName());
}
}

Expand Down Expand Up @@ -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.name;
return Localizer.Format("#FF_Achievement_DockingAchievement_desc", FirstKerbalText().Envelope(), outermostBodyInSystem.GetDisplayName());
}
}

Expand Down Expand Up @@ -1355,7 +1356,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";
}
}

Expand Down Expand Up @@ -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());
}
}

Expand Down Expand Up @@ -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());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/achievements/RibbonPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/util/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/util/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion src/window/DisplayWindow.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using UnityEngine;
using System.Collections.Generic;
using KSP.Localization;

namespace Nereid
{
Expand Down Expand Up @@ -522,7 +523,7 @@ private void DrawLocation(ProtoCrewMember kerbal)
}
else if(vessel!=null)
{
location = vessel.mainBody.GetName();
location = Localizer.Format(vessel.mainBody.GetDisplayName());
}
else
{
Expand Down