Skip to content

Commit

Permalink
Localize menu items is Graphic Element Scale dropdown (#14714)
Browse files Browse the repository at this point in the history
* Fix PostDiff job

* fix
  • Loading branch information
zeusongit authored Dec 8, 2023
1 parent 992e54c commit 006113e
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 4 deletions.
63 changes: 63 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 22 additions & 1 deletion src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3861,4 +3861,25 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
<data name="NotificationToAgreeMLNodeautocompleteTOU" xml:space="preserve">
<value>To access the Recommended Nodes feature, please read and accept Dynamo &gt; Agreement and Terms of Use.</value>
</data>
</root>
<data name="GESUnitCentimeters" xml:space="preserve">
<value>Centimeters</value>
</data>
<data name="GESUnitFeet" xml:space="preserve">
<value>Feet</value>
</data>
<data name="GESUnitInches" xml:space="preserve">
<value>Inches</value>
</data>
<data name="GESUnitKilometers" xml:space="preserve">
<value>Kilometers</value>
</data>
<data name="GESUnitMeters" xml:space="preserve">
<value>Meters</value>
</data>
<data name="GESUnitMiles" xml:space="preserve">
<value>Miles</value>
</data>
<data name="GESUnitMillimeters" xml:space="preserve">
<value>Millimeters</value>
</data>
</root>
25 changes: 23 additions & 2 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3602,7 +3602,7 @@ You can manage this in Preferences -&gt; Security.</value>
<data name="PackageDeprecatedTooltip" xml:space="preserve">
<value>This package is outdated and cannot be installed.</value>
</data>
<data name="PackageManagerMyPackagesPublishVersion" xml:space="preserve">
<data name="PackageManagerMyPackagesPublishVersion" xml:space="preserve">
<value>Publish Version</value>
</data>
<data name="SplashScreenViewExtensions" xml:space="preserve">
Expand Down Expand Up @@ -3848,4 +3848,25 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
<data name="NotificationToAgreeMLNodeautocompleteTOU" xml:space="preserve">
<value>To access the Recommended Nodes feature, please read and accept Dynamo &gt; Agreement and Terms of Use.</value>
</data>
</root>
<data name="GESUnitCentimeters" xml:space="preserve">
<value>Centimeters</value>
</data>
<data name="GESUnitFeet" xml:space="preserve">
<value>Feet</value>
</data>
<data name="GESUnitInches" xml:space="preserve">
<value>Inches</value>
</data>
<data name="GESUnitKilometers" xml:space="preserve">
<value>Kilometers</value>
</data>
<data name="GESUnitMeters" xml:space="preserve">
<value>Meters</value>
</data>
<data name="GESUnitMiles" xml:space="preserve">
<value>Miles</value>
</data>
<data name="GESUnitMillimeters" xml:space="preserve">
<value>Millimeters</value>
</data>
</root>
31 changes: 30 additions & 1 deletion src/DynamoCoreWpf/ViewModels/Menu/PreferencesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,35 @@ public bool importSettingsContent(string content)
return setSettings(newPreferences);
}

/// <summary>
/// Returns localized resource strings for Units
/// </summary>
private string GetLocalizedUnits(Enum value)
{
if (value != null)
{
switch (value)
{
case Configurations.Units.Millimeters:
return Res.GESUnitMillimeters;
case Configurations.Units.Centimeters:
return Res.GESUnitCentimeters;
case Configurations.Units.Kilometers:
return Res.GESUnitKilometers;
case Configurations.Units.Meters:
return Res.GESUnitMeters;
case Configurations.Units.Inches:
return Res.GESUnitInches;
case Configurations.Units.Feet:
return Res.GESUnitFeet;
case Configurations.Units.Miles:
return Res.GESUnitMiles;
}
}
return null;
}


private bool setSettings(PreferenceSettings newPreferences)
{
// Explicit copy
Expand Down Expand Up @@ -1381,7 +1410,7 @@ public PreferencesViewModel(DynamoViewModel dynamoViewModel)
SelectedLanguage = Configurations.SupportedLocaleDic.FirstOrDefault(x => x.Value == preferenceSettings.Locale).Key;

// Chose the scaling unit, if option is allowed by user
UnitList = Configurations.SupportedUnits.Keys.Select(x => x.ToString()).ToObservableCollection();
UnitList = Configurations.SupportedUnits.Keys.Select(x => GetLocalizedUnits(x)).ToObservableCollection();
SelectedUnits = Configurations.SupportedUnits.FirstOrDefault(x => x.Key.ToString() == preferenceSettings.GraphicScaleUnit).Key.ToString();

GroupStyleFontSizeList = preferenceSettings.PredefinedGroupStyleFontSizes;
Expand Down

0 comments on commit 006113e

Please sign in to comment.