Skip to content

Commit

Permalink
Fix localization for Spanish Civil 3D (#9876)
Browse files Browse the repository at this point in the history
* Fix tooltip for Spanish Civil 3D

In AutoCAD/Civil3D, `CurrentUICulture.ToString()` will return traditional `es-ES_tradnl`,
instead of plain `es-ES`. This will fail the finding of xml document later.

This change uses `CurrentUICulture.Name` instead.
From MS DOC for `CultureInfo.Name`:
> Gets the culture name in the format languagecode2-country/regioncode2.

* More fix for samples and gallery
  • Loading branch information
angelowang authored and QilongTang committed Aug 5, 2019
1 parent 6879028 commit ddbf7e3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/DynamoCore/Configuration/PathManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ private static string GetSamplesFolder(string dataRootDirectory)
dataRootDirectory = Directory.GetParent(versionedDirectory).FullName;
}

var uiCulture = CultureInfo.CurrentUICulture.ToString();
var uiCulture = CultureInfo.CurrentUICulture.Name;
var sampleDirectory = Path.Combine(dataRootDirectory, SamplesDirectoryName, uiCulture);

// If the localized samples directory does not exist then fall back
Expand Down Expand Up @@ -582,7 +582,7 @@ private static string GetGalleryDirectory(string commonDataDir)
commonDataDir = Directory.GetParent(versionedDirectory).FullName;
}

var uiCulture = CultureInfo.CurrentUICulture.ToString();
var uiCulture = CultureInfo.CurrentUICulture.Name;
var galleryDirectory = Path.Combine(commonDataDir, GalleryDirectoryName, uiCulture);

// If the localized gallery directory does not exist then fall back
Expand Down
2 changes: 1 addition & 1 deletion src/DynamoCore/Library/DocumentationServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private static bool ResolveForAssembly(string assemblyLocation,
baseDir = Path.GetDirectoryName(Path.GetFullPath(assemblyLocation));
}

var language = System.Threading.Thread.CurrentThread.CurrentUICulture.ToString();
var language = System.Threading.Thread.CurrentThread.CurrentUICulture.Name;
//try with the system culture
var localizedDocPath = Path.Combine(baseDir, language);

Expand Down
2 changes: 1 addition & 1 deletion src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1373,7 +1373,7 @@ private void ShowOpenDialogAndOpenResult(object parameter)
{
Assembly dynamoAssembly = Assembly.GetExecutingAssembly();
string location = Path.GetDirectoryName(dynamoAssembly.Location);
string UICulture = CultureInfo.CurrentUICulture.ToString();
string UICulture = CultureInfo.CurrentUICulture.Name;
string path = Path.Combine(location, "samples", UICulture);

if (Directory.Exists(path))
Expand Down

0 comments on commit ddbf7e3

Please sign in to comment.