Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d93197ea4e43
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c4952aa61258
Choose a head ref
  • 4 commits
  • 8 files changed
  • 1 contributor

Commits on Aug 12, 2021

  1. l10n

    eggrobin committed Aug 12, 2021
    Copy the full SHA
    a2499f9 View commit details
  2. make it work for stock

    eggrobin committed Aug 12, 2021
    Copy the full SHA
    d9e9ffa View commit details

Commits on Aug 13, 2021

  1. rename

    eggrobin committed Aug 13, 2021
    Copy the full SHA
    bdc760f View commit details
  2. Merge pull request #3092 from eggrobin/frame-selector-ui

    Translate technical terms in the new frame selector UI
    eggrobin authored Aug 13, 2021
    Copy the full SHA
    c4952aa View commit details
12 changes: 0 additions & 12 deletions ksp_plugin_adapter/compatibility_extensions.cs

This file was deleted.

2 changes: 1 addition & 1 deletion ksp_plugin_adapter/ksp_plugin_adapter.cs
Original file line number Diff line number Diff line change
@@ -935,7 +935,7 @@ private void LateUpdate() {
if (speed_display?.textTitle != null &&
speed_display?.textSpeed != null &&
!ferram_owns_the_speed_display) {
speed_display.textTitle.text = plotting_frame_selector_.ShortName();
speed_display.textTitle.text = plotting_frame_selector_.NavballName();
var active_vessel_velocity =
plugin_has_active_manageable_vessel
? (Vector3d)plugin_.VesselVelocity(
2 changes: 1 addition & 1 deletion ksp_plugin_adapter/ksp_plugin_adapter.csproj
Original file line number Diff line number Diff line change
@@ -106,7 +106,6 @@
<Compile Include="boxed.cs" />
<Compile Include="burn_editor.cs" />
<Compile Include="collision_reporter.cs" />
<Compile Include="compatibility_extensions.cs" />
<Compile Include="config_node_extensions.cs" />
<Compile Include="config_node_parsers.cs" />
<Compile Include="culture.cs" />
@@ -121,6 +120,7 @@
<Compile Include="ksp_plugin_adapter.cs" />
<Compile Include="interface.cs" />
<Compile Include="loader.cs" />
<Compile Include="localization_extensions.cs" />
<Compile Include="logging.cs" />
<Compile Include="main_window.cs" />
<Compile Include="map_node_pool.cs" />
45 changes: 25 additions & 20 deletions ksp_plugin_adapter/localization/en-us.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Localization {
en-us {
// Placeholder-only strings for extracting specific forms.
#Principia_GrammaticalForm_Standalone = <<C:1>>

// MainWindow
#Principia_MainWindow_PluginNotStarted = Plugin is not started
@@ -40,33 +42,36 @@ Localization {
#Principia_SpeedDisplayText = <<1>> m/s // <<1>>: active_vessel_velocity.magnitude.ToString("F1").

// ReferenceFrameSelector
#Principia_ReferenceFrameSelector_Name_Target = Target-Centred <<1>> Orbit // <<1>> selected vessel
#Principia_ReferenceFrameSelector_Name_BodyCentredNonRotating = <<1>>-Centred Inertial // <<1>> centred body name
#Principia_ReferenceFrameSelector_Name_BarycentricRotating = <<1>>-<<2>> Barycentric // <<1>> centred body name <<2>> secondary body name
#Principia_ReferenceFrameSelector_Name_BodyCentredParentDirection = <<1>>-Centred <<2>> Orbit // <<1>> secondary body name <<2>> centred body name
#Principia_ReferenceFrameSelector_Name_BodySurface = <<1>>-Centred <<1>>-Fixed // <<1>> centred body name (first letter)
#Principia_ReferenceFrameSelector_ShortName_Target = Tgt <<1>>O // <<1>> selected vessel (first letter)
#Principia_ReferenceFrameSelector_ShortName_BodyCentredNonRotating = <<1>>CI // <<1>> centred body name (first letter)
#Principia_ReferenceFrameSelector_ShortName_BarycentricRotating = <<1>><<2>>B // <<1> >centred body name (first letter) <<2>> secondary body name (first letter)
#Principia_ReferenceFrameSelector_ShortName_BodyCentredParentDirection = <<1>>C<<2>>O // <<1>> centred body name (first letter) <<2>> secondary body name (first letter)
#Principia_ReferenceFrameSelector_ShortName_BodySurface = <<1>>C<<1>>F // <<1>> centred body name (first letter)
// <<1>> and <<2>> are the names of the relevant celestial bodies without articles, <<2>> being the parent of <<1>>.
#Principia_ReferenceFrameSelector_Name_Target = Target-<<1>>-Orbit
#Principia_ReferenceFrameSelector_Name_BodyCentredNonRotating = <<1>>-Centred Inertial
#Principia_ReferenceFrameSelector_Name_BodyCentredParentDirection = <<1>>-<<2>>-Orbit
#Principia_ReferenceFrameSelector_Name_BodySurface = <<1>>-Centred <<1>>-Fixed

// <<1>> and <<2>> are the first letters of the relevant celestial bodies, <<2>> being the parent of <<1>>.
#Principia_ReferenceFrameSelector_Abbreviation_Target.en-us = Tgt <<1>>O
#Principia_ReferenceFrameSelector_Abbreviation_BodyCentredNonRotating.en-us = <<1>>CI
#Principia_ReferenceFrameSelector_Abbreviation_BodyCentredParentDirection.en-us = <<1>><<2>>O
#Principia_ReferenceFrameSelector_Abbreviation_BodySurface.en-us = <<1>>C<<1>>F
// <<1>> is the full name of the reference frame, <<2>> is its abbreviation.
#Principia_ReferenceFrameSelector_Description_Heading = <<1>> (<<2>>) reference frame:
#Principia_ReferenceFrameSelector_Description_Target = The target vessel, <<1>>, is fixed.\nThe plane of its orbit around <<2>> is horizontal.\nThe reference frame rotates with the orbit, fixing the direction of <<2>>. // <<1>> target vessel name <<2>> centre body name
#Principia_ReferenceFrameSelector_Description_BodyCentredNonRotating = The centre of <<1>> is fixed.\nIts equator is horizontal.\nThe reference frame does not rotate. // <<1>> centred body name
#Principia_ReferenceFrameSelector_Description_BarycentricRotating = Reference frame fixing the barycentre of <<1>> and <<2>>, the plane in which they move about the barycentre, and the line between them // <<1>> secondary body name <<2>> centred body name
#Principia_ReferenceFrameSelector_Description_BodyCentredParentDirection = The centre of <<1>> is fixed.\nThe plane of its orbit around <<2>> is horizontal.\nThe reference frame rotates with the orbit, fixing the direction of <<2>>. // <<1>> secondary body name <<2>> centred body name
#Principia_ReferenceFrameSelector_Description_BodySurface = <<1>> is fixed.\nIts equator is horizontal.\nThe reference frame rotates with <<1>>. // <<1>>centred body name
// <<1>> and <<2>> are the names of the relevant bodies, with articles if appropriate, <<2>> being the parent of <<1>>.
// For the target frame, <<1>> is the name of the target vessel.
#Principia_ReferenceFrameSelector_Description_Target = The target vessel, <<1>>, is fixed.\nThe plane of its orbit around <<2>> is horizontal.\nThe reference frame rotates with the orbit, fixing the direction of <<2>>.
#Principia_ReferenceFrameSelector_Description_BodyCentredNonRotating = The centre of <<1>> is fixed.\nIts equator is horizontal.\nThe reference frame does not rotate.
#Principia_ReferenceFrameSelector_Description_BodyCentredParentDirection = The centre of <<1>> is fixed.\nThe plane of its orbit around <<2>> is horizontal.\nThe reference frame rotates with the orbit, fixing the direction of <<2>>.
#Principia_ReferenceFrameSelector_Description_BodySurface = <<1C>> is fixed.\nIts equator is horizontal.\nThe reference frame rotates with <<1>>.
#Principia_ReferenceFrameSelector_ReferencePlane_Centred = equator of <<1>> // <<1>> centred body
#Principia_ReferenceFrameSelector_ReferencePlane_Secondary_Target = the target
#Principia_ReferenceFrameSelector_ReferencePlane = orbit of <<1>> around <<2>> // <<1>> secondary body <<2>> centred body
#Principia_ReferenceFrameSelector_ToggleButton = <<1>> selection (<<2>>)... // <<1>> plotting <<2>> selected frame
#Principia_ReferenceFrameSelector_Title = <<1>> selection (<<2>>) // <<1>> plotting <<2>> selected frame
#Principia_ReferenceFrameSelector_Tooltip_BodyCentredNonRotating = For perturbed Keplerian trajectories around <<1>>.
#Principia_ReferenceFrameSelector_Tooltip_BodySurface = For operations involving the surface of <<1>>: landings, remote sensing, imaging, ground communications, etc.
#Principia_ReferenceFrameSelector_Tooltip_BodyCentredParentDirection = For flybys of <<1>>, transfers to or from it.
#Principia_ReferenceFrameSelector_Tooltip_Target = For intercepts or rendez-vous with the target vessel.
// <<1>> is the full name of the reference frame, <<2>> is the central body.
#Principia_ReferenceFrameSelector_Tooltip_BodyCentredNonRotating = <<1>> reference frame: for perturbed Keplerian trajectories around <<2>>.
#Principia_ReferenceFrameSelector_Tooltip_BodySurface = <<1>> reference frame: for operations involving the surface of <<2>>: landings, remote sensing, imaging, ground communications, etc.
#Principia_ReferenceFrameSelector_Tooltip_BodyCentredParentDirection = <<1>> reference frame: for flybys of <<2>>, transfers to or from it.
#Principia_ReferenceFrameSelector_Tooltip_Target = <<1>> reference frame: for intercepts or rendez-vous with the target vessel.
#Principia_ReferenceFrameSelector_Target = Target: <<1>>
#Principia_ReferenceFrameSelector_TargetFrameSelected = Using target-centred frame selected on navball speed display\n\n<<1>> // <<1>> describe when target selected


// OrbitAnalyser
37 changes: 18 additions & 19 deletions ksp_plugin_adapter/localization/zh-cn.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Localization {
zh-cn {
#Principia_GrammaticalForm_Standalone = <<C:1>>

// MainWindow
#Principia_MainWindow_PluginNotStarted = Principia没有正确启动
@@ -42,32 +43,30 @@ Localization {

// ReferenceFrameSelector
// TODO(egg): translations.
#Principia_ReferenceFrameSelector_Name_Target = Target-Centred <<1>> Orbit // <<1>> selected vessel
#Principia_ReferenceFrameSelector_Name_BodyCentredNonRotating = <<1>>-Centred Inertial // <<1>> centred body name
#Principia_ReferenceFrameSelector_Name_BarycentricRotating = <<1>>-<<2>> Barycentric // <<1>> centred body name <<2>> secondary body name
#Principia_ReferenceFrameSelector_Name_BodyCentredParentDirection = <<1>>-Centred <<2>> Orbit // <<1>> secondary body name <<2>> centred body name
#Principia_ReferenceFrameSelector_Name_BodySurface = <<1>>-Centred <<1>>-Fixed // <<1>> centred body name (first letter)
#Principia_ReferenceFrameSelector_ShortName_Target = Tgt <<1>>O // <<1>> selected vessel (first letter)
#Principia_ReferenceFrameSelector_ShortName_BodyCentredNonRotating = <<1>>CI // <<1>> centred body name (first letter)
#Principia_ReferenceFrameSelector_ShortName_BarycentricRotating = <<1>><<2>>B // <<1> >centred body name (first letter) <<2>> secondary body name (first letter)
#Principia_ReferenceFrameSelector_ShortName_BodyCentredParentDirection = <<1>>C<<2>>O // <<1>> centred body name (first letter) <<2>> secondary body name (first letter)
#Principia_ReferenceFrameSelector_ShortName_BodySurface = <<1>>C<<1>>F // <<1>> centred body name (first letter)
#Principia_ReferenceFrameSelector_Description_Heading = <<1>> (<<2>>) reference frame:
#Principia_ReferenceFrameSelector_Description_Target = The target vessel, <<1>>, is fixed.\nThe plane of its orbit around <<2>> is horizontal.\nThe reference frame rotates with the orbit, fixing the direction of <<2>>. // <<1>> target vessel name <<2>> centre body name
#Principia_ReferenceFrameSelector_Description_BodyCentredNonRotating = The centre of <<1>> is fixed.\nIts equator is horizontal.\nThe reference frame does not rotate. // <<1>> centred body name
#Principia_ReferenceFrameSelector_Description_BarycentricRotating = Reference frame fixing the barycentre of <<1>> and <<2>>, the plane in which they move about the barycentre, and the line between them // <<1>> secondary body name <<2>> centred body name
#Principia_ReferenceFrameSelector_Description_BodyCentredParentDirection = The centre of <<1>> is fixed.\nThe plane of its orbit around <<2>> is horizontal.\nThe reference frame rotates with the orbit, fixing the direction of <<2>>. // <<1>> secondary body name <<2>> centred body name
#Principia_ReferenceFrameSelector_Name_Target = 目标<<1>>轨道
#Principia_ReferenceFrameSelector_Name_BodyCentredNonRotating = <<1>>质心惯性
// The code will replace the U+200B (ZWSP) with a hyphen if both celestials have non-CJK names.
#Principia_ReferenceFrameSelector_Name_BodyCentredParentDirection = <<1>>\u200B<<2>>轨道
#Principia_ReferenceFrameSelector_Name_BodySurface = <<1>>体固
#Principia_ReferenceFrameSelector_SelectorText_Target = 轨道系
#Principia_ReferenceFrameSelector_SelectorText_BodyCentredNonRotating = 惯性系
#Principia_ReferenceFrameSelector_SelectorText_BodyCentredParentDirection = 轨道系
#Principia_ReferenceFrameSelector_SelectorText_BodySurface = 体固系
#Principia_ReferenceFrameSelector_Description_Heading = <<1>>参考系:
#Principia_ReferenceFrameSelector_Description_Target = The target vessel, <<1>>, is fixed.\nThe plane of its orbit around <<2>> is horizontal.\nThe reference frame rotates with the orbit, fixing the direction of <<2>>.
#Principia_ReferenceFrameSelector_Description_BodyCentredNonRotating = The centre of <<1>> is fixed.\nIts equator is horizontal.\nThe reference frame does not rotate.
#Principia_ReferenceFrameSelector_Description_BodyCentredParentDirection = The centre of <<1>> is fixed.\nThe plane of its orbit around <<2>> is horizontal.\nThe reference frame rotates with the orbit, fixing the direction of <<2>>.
#Principia_ReferenceFrameSelector_Description_BodySurface = <<1>> is fixed.\nIts equator is horizontal.\nThe reference frame rotates with <<1>>. // <<1>>centred body name
#Principia_ReferenceFrameSelector_ReferencePlane_Centred = (<<1>>)的赤道面 // <<1>> centred body
#Principia_ReferenceFrameSelector_ReferencePlane_Secondary_Target = 选中的目标
#Principia_ReferenceFrameSelector_ReferencePlane = (<<1>>)的轨道环绕于<<2>> // <<1>> secondary body <<2>> centred body
#Principia_ReferenceFrameSelector_ToggleButton = <<1>>选择器(<<2>>)... // <<1>> plotting <<2>> selected frame
#Principia_ReferenceFrameSelector_Title = <<1>>选择器(<<2>>) // <<1>>plotting <<2>> selected frame
// TODO(egg): translations.
#Principia_ReferenceFrameSelector_Tooltip_BodyCentredNonRotating = For perturbed Keplerian trajectories around <<1>>.
#Principia_ReferenceFrameSelector_Tooltip_BodySurface = For operations involving the surface of <<1>>: landings, remote sensing, imaging, ground communications, etc.
#Principia_ReferenceFrameSelector_Tooltip_BodyCentredParentDirection = For flybys of <<1>>, transfers to or from it.
#Principia_ReferenceFrameSelector_Tooltip_Target = For intercepts or rendez-vous with the target vessel.
#Principia_ReferenceFrameSelector_Tooltip_BodyCentredNonRotating = <<1>>参考系: for perturbed Keplerian trajectories around <<2>>.
#Principia_ReferenceFrameSelector_Tooltip_BodySurface = <<1>>参考系: for operations involving the surface of <<2>>: landings, remote sensing, imaging, ground communications, etc.
#Principia_ReferenceFrameSelector_Tooltip_BodyCentredParentDirection = <<1>>参考系: for flybys of <<2>>, transfers to or from it.
#Principia_ReferenceFrameSelector_Tooltip_Target = <<1>>参考系: for intercepts or rendez-vous with the target vessel.
#Principia_ReferenceFrameSelector_Target = 目标:<<1>>
#Principia_ReferenceFrameSelector_TargetFrameSelected = 在导航求上以选中的目标为参考定义速度\n\n<<1>> // <<1>> describe when target selected

56 changes: 56 additions & 0 deletions ksp_plugin_adapter/localization_extensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using KSP.Localization;
using System.Text.RegularExpressions;

namespace principia {
namespace ksp_plugin_adapter {

internal static class L10N {
private const string english_us_ = "en-us";

public static bool IsCJKV(string text) {
return Regex.IsMatch(
text,
@"^[\p{IsCJKUnifiedIdeographs}\p{IsCJKUnifiedIdeographsExtensionA}]*$");
}

public static string ZWSPToHyphenBetweenNonCJK(string text) {
return Regex.Replace(
text,
@"([^\p{IsCJKUnifiedIdeographs}\p{IsCJKUnifiedIdeographsExtensionA}])" +
"\u200B" +
@"([^\p{IsCJKUnifiedIdeographs}\p{IsCJKUnifiedIdeographsExtensionA}])",
"$1-$2");
}

public static string Standalone(string name) {
return Localizer.Format("#Principia_GrammaticalForm_Standalone", name);
}

public static string NameWithoutArticle(this CelestialBody body) {
// This will need to be adjusted when we add support for other languages
// with articles.
return (Localizer.CurrentLanguage == english_us_ &&
body.displayName.StartsWith("The ")) ? body.name : body.displayName;
}

public static string NameWithArticle(this CelestialBody body) {
// TODO(egg): should we apped ^d instead of prepending "the"? Certainly
// we would need to do that for other languages.
return (Localizer.CurrentLanguage == english_us_ &&
body.displayName.StartsWith("The ")) ? "the " + body.name
: body.displayName;
}

public static string FormatOrNull(string template, params object[] args) {
// Optional translations include the language name so that they do not fall
// back to English.
string qualified_template = $"{template}.{Localizer.CurrentLanguage}";
if (!Localizer.Tags.ContainsKey(qualified_template)) {
return null;
}
return Localizer.Format(qualified_template, args);
}
}

}
}
2 changes: 1 addition & 1 deletion ksp_plugin_adapter/orbit_analyser.cs
Original file line number Diff line number Diff line change
@@ -389,7 +389,7 @@ public static string OrbitDescription(CelestialBody primary,
}
return Localizer.Format("#Principia_OrbitAnalyser_OrbitDescription",
properties,
primary.name);
primary.NameWithoutArticle());
}

private void RenderLowestAltitude(OrbitalElements? elements,
Loading