I have done both localization
commands and options. I want to keep the English shortcuts, just like Rhino commands, such as
_FilletSrf . The English version is the same as the shortcuts in Chinese or other languages.
Because I will execute command scripts in the plug-in, I want to ensure that the shortcuts for executing scripts are consistent after localization.
I have searched forums and examples, but there seems to be no relevant examples.
Are there any solutions or tips?
Thank you very much!
As far as I know it should work out of the box. As long as your command class’ property
EnglishName returns the required English name, prepending the command name with an underscore will call the command by its English name.
It should be said that I only localize option, no localization commands, and I want to have English shortcuts at the same time as localizing option.
This allows users to maintain consistent shortcuts regardless of the language they are using.
Are you using the
GetOption classes? If so, you can use
LocalizeStringPair I think, see for example https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Input_Custom_GetBaseClass_AddOptionDouble.htm
Maybe you can post an example of code?
It should be this class. What I want to do should be this. It should be that my previous localization options were wrong. I directly introduced the localized string as a parameter instead of using the
LocalizeStringPair class. I have time to test it.
I will report the test results after the test.
You helped me again, thank you!
This is the code I have successfully tested, I will submit it to others for reference.
Rhino.Input.Custom.GetOption go = new Rhino.Input.Custom.GetOption(); string str_test_local = "测试"; //your localization Rhino.UI.LocalizeStringPair lsp = new Rhino.UI.LocalizeStringPair("Test", str_test_local); Rhino.Input.Custom.OptionInteger option_int = new Rhino.Input.Custom.OptionInteger(0); go.AddOptionInteger(lsp,ref option_int); go.Get();
ON_wString str_test_local(L"测试"); //your localization CRhinoCommandOptionValue cov_test(L"Test", str_test_local); //or CRhinoCommandOptionName con_test(L"Test", str_test_local);