How to change the language for the FitToWidth and FitToPage?

1 Answer 50 Views
PDFViewer
Dominik
Top achievements
Rank 1
Iron
Iron
Dominik asked on 07 Dec 2023, 09:22 AM

Hey im using the telerik PercentComboBox and i want to change language of the FitToPage and FitToWidthto be displayed in german.

 

  <telerik:PercentComboBox DataContext="{Binding DataContext, RelativeSource={RelativeSource AncestorType={x:Type local:DialogControl}}}"
                           Value="{Binding ScaleFactor,ElementName=pdfViewer, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                           RadPdfViewer="{Binding ElementName=pdfViewer}" ShowFitToWidth="True" ShowFitToPage="True"
                           telerik:Windows11ThemeSizeHelper.EnableDynamicAnimation="True" Language="de-DE">
      <telerik:PercentComboBox.PercentValues>
          <telerik:Percent Value="200"/>
          <telerik:Percent Value="150"/>
          <telerik:Percent Value="125"/>
          <telerik:Percent Value="110"/>
          <telerik:Percent Value="100"/>
          <telerik:Percent Value="90"/>
          <telerik:Percent Value="75"/>
          <telerik:Percent Value="50"/>
          <telerik:Percent Value="30"/>
      </telerik:PercentComboBox.PercentValues>
  </telerik:PercentComboBox>

 

Hope there is a way. Thanks

Dominik

1 Answer, 1 is accepted

Sort by
0
Accepted
Stenly
Telerik team
answered on 12 Dec 2023, 08:55 AM

Hello Dominik,

To localize the strings in the drop-down part of the PercentComboBox element, a custom LocalizationManager can be created and its GetStringOverride method can be overridden. The resource keys are "FixedDocumentViewers_FitWidth" and "FixedDocumentViewers_ZoomToPageLevel".

The following code snippets show how to achieve this requirement:

public class CustomLocalizationManager : LocalizationManager
{
    public override string GetStringOverride(string key)
    {
        if (Thread.CurrentThread.CurrentCulture.Name == "de-DE")
        {
            if (key == "FixedDocumentViewers_FitWidth")
            {
                return "An Breite anpassen";
            }
            if (key == "FixedDocumentViewers_ZoomToPageLevel")
            {
                return "Zoomen Sie auf Seitenebene";
            }
        }

        return base.GetStringOverride(key);
    }
}
LocalizationManager.Manager = new CustomLocalizationManager();

The produced result is as follows:

I hope the provided information will be of help to you.

Regards,
Stenly
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
PDFViewer
Asked by
Dominik
Top achievements
Rank 1
Iron
Iron
Answers by
Stenly
Telerik team
Share this question
or