Hello,
I'm trying to add multi-language support in my plugin.
I currently have the strings hardcoded in the GeDialog's CreateLayout method like this:
self.AddStaticText(self.HELP_ID, c4d.BFV_BOTTOM | c4d.BFV_SCALE | c4d.BFH_LEFT, 0, 0, "Help")
All of the strings are labels for UI menu commands and gadgets. I understand that the best practice is to put the UI strings into folders within a 'res' folder like so:
res
└ strings_en-US
└ c4d_strings.str
└ strings_fr-FR
└ c4d_strings.str
My issue is I don't know how to use the STRINGTABLE in the .str with my Python CommandPlugin. Here's an example of the c4d_strings.str content:
c4d_strings.str (strings_en-US)
STRINGTABLE
{
IDS_TEST "Test Plugin";
TITLEVIEW_ID "Test - View";
HELP_ID "Help";}
}
c4d_strings.str (strings_fr-FR)
STRINGTABLE
{
IDS_TEST "Test Plugin";
TITLEVIEW_ID "Test - Vue";
HELP_ID "Aide";
}
Please forgive all of these questions:
- What is the best practice for loading these STRINGTABLES and using them in the UI? I couldn't find an example using a CommandPlugin in the official Cinema 4D Python examples though I did see that the py-ies_meta_r12.py SceneSaverPlugin example uses a method called c4d.plugins.GeLoadString.
- If GeLoadString is the way to go, would I set up my IDs in my GeDialog class and reference the corresponding ID in the STRINGTABLE with this method?
- Would Cinema 4D then grab the correct string based on the user's language if my folder structure is set up appropriately?
- Is there a similar method for automatically handling the localized date and time format?
- As mine is not an Object plugin, I won't need a description folder, is that correct?
- What should I do with the c4d_symbols.h file?
Thank you so much!