Best practices for custom Rhino GUI language localization?


I’m currently developing a GUI in Python to help automate design of medical prosthesis. My client has French and English users that I would like to support in their own language (help information, buttons and controls displayed names, etc.) . What would you recommend as the best practices to support two or more languages in your custom GUI controls?

Thanks for your suggestions!

Here is a tutorial I found using the gettext Python module. Is it something frequently done for Rhino language customization?

We do have a similar system to gettext, but it is a system that we built ourselves. My answer really depends on the complexity of your project. In our case, we have many developers working on a very large codebase and the strings need to be translated into at least 11 languages (I think that’s where we are now.) We wrote an application that walks through the entire source tree and generates XML files that our localization team uses to create a localized phrase for every English string. These XML files are then included with Rhino and used at runtime to lookup the appropriate string for a given English string using a technique probably similar to gettext.

I’m assuming your case doesn’t need all of this complexity. For your case, you may just want to have a file that contains a dictionary of all the English strings as keys with their French translations as values. In that file have a function that takes an English string and either returns that same English string or the French one depending on the language that the user is running Rhino in. This can be found by looking at the ApplicationSettings class in RhinoCommon. All of your code that displays strings should be call this function.

Thanks for the advice. The gettext approach or Rhino’s general one seemed effectively too heavy for my few controls…