runtime icon indicating copy to clipboard operation
runtime copied to clipboard

[LOC]The "on" is not translated for Error on errorProvider property on all local languages

Open Zheng-Li01 opened this issue 2 years ago • 10 comments

.NET version

.NET 9.0.100-rc2.24455.8

Did it work in .NET Framework?

No

Did it work in any of the earlier releases of .NET Core or .NET 5+?

No, the issue also can reproduce from .NET Core 3.1

Issue description

The on is not translated for Error on errorProvider property on all 13 local languages: CHS, CHT, CSY, DEU, ESN, FRA, ITA, JPN, KOR, PLK, PTB, RUS, TRK. image

Steps to reproduce

  1. Create .NET Winforms project with ErrorProvide & Button controls.
  2. Observer the "on" in Error on errorProvider property.

Zheng-Li01 avatar Sep 06 '24 06:09 Zheng-Li01

Presumably this is in the designer

JeremyKuhne avatar Sep 10 '24 19:09 JeremyKuhne

@LeafShi1 - I think this name is coming from the PropertyGrid in the Framework, but I'm not sure, could you please investigate. This property is coming from IExtenderProvider

Tanya-Solyanik avatar Sep 24 '24 19:09 Tanya-Solyanik

The call stack in .netcore:

System.ComponentModel.TypeConverter.dll!System.ComponentModel.ExtendedPropertyDescriptor.DisplayName.get() Line 105	C#
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.GridEntry.DisplayNameSortComparer.Compare(object left, object right) Line 16	C#
System.Private.CoreLib.dll!System.Array.SorterObjectArray.PickPivotAndPartition(int lo, int hi) Line 2394	C#
System.Private.CoreLib.dll!System.Array.SorterObjectArray.IntroSort(int lo, int hi, int depthLimit) Line 2369	C#
System.Private.CoreLib.dll!System.Array.SorterObjectArray.IntrospectiveSort(int left, int length) Line 2317	C#
System.Private.CoreLib.dll!System.Array.Sort(System.Array keys, System.Array items, int index, int length, System.Collections.IComparer comparer) Line 2044	C#
System.Private.CoreLib.dll!System.Array.Sort(System.Array array, System.Collections.IComparer comparer) Line 1978	C#
System.ComponentModel.TypeConverter.dll!System.ComponentModel.PropertyDescriptorCollection.InternalSort(string[] names) Line 328	C#
System.ComponentModel.TypeConverter.dll!System.ComponentModel.PropertyDescriptorCollection.CopyTo(System.Array array, int index) Line 126	C#
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.GridEntry.GetChildEntries() Line 1325	C#
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.GridEntry.CreateChildren(bool useExistingChildren) Line 947	C#
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.SingleSelectRootGridEntry.CreateChildren(bool diffOldChildren) Line 193	C#
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.GridEntry.InternalExpanded.set(bool value) Line 329	C#
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.SingleSelectRootGridEntry.SingleSelectRootGridEntry(System.Windows.Forms.PropertyGridInternal.PropertyGridView ownerGridView, object target, System.IServiceProvider baseProvider, System.ComponentModel.Design.IDesignerHost host, System.Windows.Forms.Design.PropertyTab ownerTab, System.Windows.Forms.PropertySort sortType) Line 47	C#
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.GridEntry.CreateRootGridEntry(System.Windows.Forms.PropertyGridInternal.PropertyGridView view, object[] objects, System.IServiceProvider baseProvider, System.ComponentModel.Design.IDesignerHost currentHost, System.Windows.Forms.Design.PropertyTab tab, System.Windows.Forms.PropertySort initialSortType) Line 899	C#
System.Windows.Forms.dll!System.Windows.Forms.PropertyGrid.UpdateSelection() Line 4165	C#
System.Windows.Forms.dll!System.Windows.Forms.PropertyGrid.RefreshProperties(bool clearCached) Line 3410	C#
System.Windows.Forms.dll!System.Windows.Forms.PropertyGrid.Refresh(bool clearCached) Line 3386	C#
System.Windows.Forms.dll!System.Windows.Forms.PropertyGrid.SelectedObjects.set(object[] value) Line 1115	C#
System.Windows.Forms.dll!System.Windows.Forms.PropertyGrid.SelectedObject.set(object value) Line 891	C#

The root of the problem is that the resource is not localized when getting the DisplayName image

@Tanya-Solyanik So the changes should be made to the file System.ComponentModel.ExtendedPropertyDescriptor , where do we change that file and can we change it at all?

This issue doesn't reproduce in .NetFramwork project, cause the DisplayName was override in VsTargetFrameworkPropertyDescriptor.cs

LeafShi1 avatar Sep 26 '24 08:09 LeafShi1

@LeafShi1 - great investigation.

We don't own Systerm.ComponentModel in .NET

Tanya-Solyanik avatar Oct 01 '24 05:10 Tanya-Solyanik

How do we opt into localization in this string - https://github.com/dotnet/runtime/blob/7b1e788c34ee9a44f6dc548c170c153dd7eab559/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/ExtendedPropertyDescriptor.cs#L102

Tanya-Solyanik avatar Oct 01 '24 05:10 Tanya-Solyanik

Tagging subscribers to this area: @dotnet/area-system-componentmodel See info in area-owners.md if you want to be subscribed.

dotnet-policy-service avatar Oct 01 '24 21:10 dotnet-policy-service

The LOC is here: https://github.com/dotnet/runtime/blob/81efcade9e543a2c03457b3bc87a2bc76b36057e/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/ExtendedPropertyDescriptor.cs#L102

This needs to move to a new resource string like "{0} on {1}".

steveharter avatar Oct 02 '24 20:10 steveharter

@steveharter - shouldn't we set "System.Resources.UseSystemResourceKeys" app context switch on the designer process?

Tanya-Solyanik avatar Oct 03 '24 03:10 Tanya-Solyanik

I can see the localization is present - https://github.com/dotnet/runtime/blob/main/src/libraries/System.ComponentModel.TypeConverter/src/Resources/Strings.resx#L283

<data name="MetaExtenderName" xml:space="preserve">
  <value>{0} on {1}</value>
</data>

I think this should solve

name = SR.Format(SR.MetaExtenderName, name, providerName);

rekker22 avatar Oct 12 '25 16:10 rekker22

I'm interested in this issue. It seems like a straightforward fix to replace the hardcoded 'on' with SR.MetaExtenderName. May I be assigned to this?

aw0lid avatar Jan 12 '26 23:01 aw0lid