Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need to know which are cultures are supported for TextBlock.IsHyphenationEnabled

Tags:

c#

wpf

I'm currently working on a WPF application and using the TextBlock.IsHyphenationEnabled property to handle text hyphenation. I understand that hyphenation behavior can be culture-specific, and I'm trying to ensure proper functionality across different languages.

Could anyone provide a list of cultures that are officially supported for hyphenation when using the TextBlock.IsHyphenationEnabled property? Specifically, I'm interested in knowing if languages like Swedish (sv-SE), German (de-DE), and others are fully supported.

I see some code related to it but not sure how culture support is done:

Class: NaturalLanguageHyphenator

 public override bool IsCultureSupported(CultureInfo culture)
 {
    // Accept all cultures for the time being. Ideally, NL6 should provide a way for the client to test supported culture.
    return true;
 }

Additionally, if any specific settings or configurations are required on the client machine, such as installing language packs in Windows

Code and debugging values for TextBlock and Culture info (sv-SE not working here)

<TextBlock IsHyphenationEnabled="True" 
Text="{Binding Name}" Language="sv-SE"
TextWrapping="Wrap"/>

System.Globalization.CultureInfo.CurrentCulture - en-IN System.Globalization.CultureInfo.CurrentUICulture - sv

Any documentation or experiences you can share would be greatly appreciated!

Thanks in advance for your help.

like image 772
Ankush Madankar Avatar asked Sep 01 '25 20:09

Ankush Madankar


1 Answers

This is not an answer, but it may help in the investigation.

As you may suspect, Hyphenation is done with the use of native dll. Most probably it is C:\Windows\System32\NaturalLanguage6.dll at very end.

There is a PresentationNative_xxxxx.dll in the middle, but it doesn't matter right now. NL6 team doesn't provide a way for the client to test supported culture, as we can read from the comment.

NaturalLanguage6.dll exports 4 functions: DllCanUnloadNow, DllGetClassObject, DllRegisterServer and DllUnregisterServer so it's a COM library.

I've found 4 CLSIDs related to this dll: {0E1EEFB2-E336-481C-B178-36261EC5A843}, {333E6924-4353-4934-A7BE-5FB5BDDDB2D6}, {89EA5B5A-D01C-4560-A874-9FC92AFB0EFA} and {D385FDAD-D394-4812-9CEC-C6575C0B2B38}, but I can't find much more. I tried to use OleView.exe to inspect NaturalLanguage6.dll, but it failed.

To make thing worse, there is no guarantee that PresentationNative_xxxxx.dll uses NaturalLanguage6.dll, especially on platforms different than Windows.

Anyway it seems that:

  • .NET team doesn't know which cultures are supported,
  • functionality is buried deep in Windows system dlls,
  • supported cultures may change with Windows updates.

Since it's pointless to call PresentationNative's methods (there's none that would help), the next likely step will be to decompile the dll to see what's inside.

like image 174
Sinus32 Avatar answered Sep 03 '25 13:09

Sinus32