Translation of the System.Windows.Input.Key enumeration into Silverlight 4?

I am currently working on some code that handles keyboard shortcuts in a Silverlight 4 application. I want to create a control window in which users can define custom keyboard shortcuts if they do not want to use standard ones. However, some keys have different translations in some languages ​​(for example, Home, Del, ...). Of course, I want to translate these texts so that each user understands the keyboard shortcuts correctly.

Is there something like an inline translation for something like that? I am thinking of something like DateTime behavior. If I work with DateTimes, texts for days or months are automatically determined through the system settings.

string dateTimeTest = DateTime.Now.ToLongDateString(); 

In the German system, this leads to the text "Freitag, 20. Juli 2012".

Is there something similar for keys? Or do I need to translate all the necessary keys manually?

Thanks in advance!

+4
source share
1 answer

As with most languages, you must do this yourself in Silverlight. Of course, there are ways to make it easier.

If you use the application outside the browser (OOB), in Silverlight 4 you can deploy a COM object that transfers its own call to GetKeyNameText ; in Silverlight 5, OOB or in the advanced browser, you can P / call it directly.

However, if you work in a browser without elevated privileges, your options are greatly reduced. I do not know about any libraries (commercial or others) that provide this function, so for this you will need to create your localizable resources and methods associated with them.

You can find the W3C Silverlight Availability Guide as a useful resource.

+1
source

All Articles