Localizing Actipro Controls

Docking/MDI for WPF Forum

Posted 3 years ago by Michael Bayer
Version: 16.1.0633
Avatar

I post this question in the Docking/MDI-Forum, but it reaches other controls too (here: the Ribbon Control).

With the SR-Class I'm able to customize the string resources, that are displayed in the user interface. I used the String Resource Browser to see the available string resources for the Docking- and the Ribbon Control. The target is to translate the displayes strings from English to German language.

I wondered, why this works sometimes and sometimes not. I'm able to customize the Options menu, that appears when clicking the arrow-icon in the right corner of a tool window (Dock, Dock as Document, Float ...):

SR.SetCustomString(SRName.UICommandCloseWindowText.ToString(), "Schliessen")
SR.SetCustomString(SRName.UICommandMakeDockedWindowText.ToString(), "Andocken")
SR.SetCustomString(SRName.UICommandMakeDocumentWindowText.ToString(),"Als Dokument andocken")

This works.It's also possible to customize some of the string resources of the Ribbon Control:

SR.SetCustomString(SRName.UICustomizeMenuItemShowAboveRibbonText.ToString(), "Ueber dem Menuband anzeigen")
SR.SetCustomString(SRName.UICustomizeMenuItemShowBelowRibbonText.ToString(), "Unter dem Menuband anzeigen")
SR.SetCustomString(SRName.UICustomizeMenuItemMinimizeRibbonText.ToString(), "Menuband minimieren")

When I start the application, the customized string resources are displayed. But other won't, although I've customized them in the same way.

For instance, with the following line I want to customize the Application Button of the Ribbon Control:

SR.SetCustomString(SRName.UIApplicationButtonScreenTipHeaderText.ToString(), "My little App")

But if I start the application, the tooltip of the Application Button  is furthermore "Application button".

Same with the tooltips of the controls of a tool window in the right upper corner (Options, Pin and Close (the X)):

SR.SetCustomString(SRName.UIAdvancedTabItemCloseButtonToolTip.ToString(), "Schliessen")
SR.SetCustomString(SRName.UIToolWindowContainerOptionsButtonToolTip.ToString(), "Optionen")

Within the String Resource Browser I see several items with the string resource Close, Auto-Hide or Options, so I may made a  mistake and take the wrong string resource.

But even if I customize all these items, the tooltips were displayed in English. The string resources for the Ribbon Control in addition contains only one item with the string Application Button, so this should be the correct string resource. Also the tooltip for the QAT (SRName.UICustomizeMenuItemCustomizeQatText) stays unchanged in English, but the text inside the popup (SRName.UICustomizeQatMenuHeaderText) is customized. And so on.

Could you please explain me, where my mistake is?

Thanks in advance

Michael

Edit: the Version is v16.1.0632

[Modified 3 years ago]

Comments (3)

Answer - Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Michael,

Some resources get assigned in XAML and thus need to be fully customized in your app startup logic before any UI ever loads.  Based on what you said, my guess is that you are doing the string customization too late for your changes to be picked up, since the XAML would have already been loaded.  Please move the string customization to be first in app startup, before you load any UI or show any windows.  That should resolve it.


Actipro Software Support

Posted 3 years ago by Michael Bayer
Avatar

You're right. That works. Great. Thany you very much. Maybe it's worth to be mentioned in the documentation, that the string resources should be customized in app startup.

Regards

Michael

Answer - Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Michael,

Great I'm glad that was it.  Actually we do have this info in the Customizing String Resources documentation topic in an Important Note block:

Any string resource customizations must be performed at application startup such as in Application.OnStartup, before any UI or controls have been referenced. This must be done since some string resources are used by static class initializers. Therefore your customizations may not be picked up if not set immediately upon application startup before UI classes are referenced.


Actipro Software Support

The latest build of this product (v2018.1 build 0675) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.