Hi,
I’m trying to figure out how to localize a vb.net plugin for rhino. Is there any sample/guide somewhere?
Best regards
There isn’t anything in RhinoCommon that will help you with localization. But there is a lot of information on the web about this.
For example:
– Dale
Thanks very much Dale for your help, I’ll look at this.
What about command names? I guess I have to override the Command.LocalName Property to return a localized string?
Yes you do.
– Dale
Thanks it works fine. With Visual studio Express I couldn’t figure out how to create resources files, but I’ve found a work around: I just duplicate the default resource file and import it back to the project.
Hi Dale,
Is there a guide to localize a C++ plugin for Rhino?
To put it another way: when I override LocalCommandName()
, how can I discriminate if the local language is for example German or Spanish and choose the right string?
Many thanks,
Pablo
Hi @pagarcia,
Here is my code in vb.net, it might help you for C++
'''<returns>The command name as it appears on the Rhino command line.</returns>
Public Overrides ReadOnly Property LocalName As String
Get
Dim language_id = Rhino.ApplicationSettings.AppearanceSettings.LanguageIdentifier
Dim culture As CultureInfo = New System.Globalization.CultureInfo(language_id)
If culture.ToString = "fr-FR" Then
Return "Test_French"
Else
Return EnglishName
End If
End Get
End Property
Do you know the equivalent in C++ of
Rhino.ApplicationSettings.AppearanceSettings.LanguageIdentifier
and
System.Globalization.CultureInfo(language_id)
?
Pablo
No idea. @dale might know?
@Matthieu_from_NAVINN, @pagarcia, see the followng:
– Dale
Hi @dale,
I’ve got an issue with this method of overriding LocalName
property to translate command names.
It generally works fine, but I’ve got several users where the command line behavior is messed up.
As far as I could test, this how the bug occurs:
- When I type the LocalName in command line, the auto-completion works, but I get an “Unknown command” message and nothing happens.
- Then I type the EnglishName I’ll also have “Unknown command” as a result.
- And finally if I retry to enter the LocalName, it works just fine and the command runs as it should.
For reminder, I’m using RhinoCOmmon for RH6, here is my code:
'''<returns>The command name as it appears on the Rhino command line.</returns>
Public Overrides ReadOnly Property LocalName As String
Get
Dim language_id = Rhino.ApplicationSettings.AppearanceSettings.LanguageIdentifier
Dim culture As CultureInfo = New System.Globalization.CultureInfo(language_id)
If culture.ToString = "fr-FR" Then
Return "Test_French"
Else
Return EnglishName
End If
End Get
End Property
To be safe I have disabled every LocalName
property overrides in my latest releases, but you might want to check this issue.
If the user changes Rhino’s language, then localized command names will not work until your plug-in is loaded the first time under the modified configuration.
Also, when the language is set to something other an English, to run the English command name, precede the command name with an underscore character.
– Dale
Thanks @Dale,
If the user changes Rhino’s language, then localized command names will not work until your plug-in is loaded the first time under the modified configuration.
The issue occurred even when I did not change the language. (My language setting was set to French from the beginning.)
I’m wondering if something in my code might raise an exception that prevent the commands to load.
Where can I get detailed traces of plugin load failure in rhino?
Thanks