ComponentFactory / Krypton

Krypton WinForms components for .NET
BSD 3-Clause "New" or "Revised" License
1.86k stars 681 forks source link

Localization does not work #236

Open waleedmakarem opened 2 years ago

waleedmakarem commented 2 years ago

I am trying to apply localization to it, but it does not work. I have tried normal button and kryptonbutton at same form, and applied below code. Normal button will localize , but kryptonbutton does not . Does KryptonToolkit support localization ? Below is my code: NB. Windows set to Localizable

For Each c As Control In Me.Controls Dim crmLang As ComponentResourceManager = New ComponentResourceManager(GetType(Form1)) crmLang.ApplyResources(c, c.Name, New CultureInfo(Language)) 'Set desired language Next c

Wagnerp commented 2 years ago

Hi @waleedmakarem

By setting the localization, do you mean for button text

waleedmakarem commented 1 year ago

Hi Wagnerp, Yes, I cannot localize KryptonButton Text property , though I can localize default WinformButton.

Wagnerp commented 1 year ago

Hi @waleedmakarem

Do you mean no RTL support or something else?

waleedmakarem commented 1 year ago

I mean to have different language support, eg English , French , German. Normally below code should localize all winform controls , but does not work for Krypton controls

For Each c As Control In Me.Controls Dim resources As ComponentResourceManager = New ComponentResourceManager(GetType(Form1)) resources.ApplyResources(c, c.Name, New CultureInfo(lang)) Next c

Wagnerp commented 1 year ago

@waleedmakarem You can alter certain strings within KryptonManager

waleedmakarem commented 1 year ago

No. I need to localize the entire winforms. with below code. it works for normal winform button control, eg. But if i used kryptonButton, it does not work. If you need to share project. I can.

Private Sub btnchangetoEnglish_Click(sender As Object, e As EventArgs) Handles btnchangetoEnglish.Click ChangeLanguage("en") End Sub

Private Sub ChangeLanguage(ByVal lang As String)
    For Each c As Control In Me.Controls
        Dim resources As ComponentResourceManager = New ComponentResourceManager(GetType(Form1))
        resources.ApplyResources(c, c.Name, New CultureInfo(lang))
    Next c
End Sub
Wagnerp commented 1 year ago

@waleedmakarem Does this help? https://github.com/Krypton-Suite/Standard-Toolkit/issues/851