Localisation according to language [SOLVED]
-
On 07/01/2015 at 21:00, xxxxxxxx wrote:
Hi,
I have a cinema 4d plugin in python language in which I have used various static texts and menus. In the pyp file I have mentioned them in English but I want them to be changed to the language according to the language being used in cinema. How can I do that ?
Thanks
Nishant -
On 07/01/2015 at 23:54, xxxxxxxx wrote:
Don't hard-code your strings in the plugin, use resource files. Then you only have to create individual string files for each language supported and Cinema will take care of using the right one (providing you organise the resource correctly).
Steve
-
On 08/01/2015 at 02:58, xxxxxxxx wrote:
Hi,
Can you give an example on how to use resource file ? I can not find it anywhere in the documentation
Thanks
Nishant -
On 08/01/2015 at 03:29, xxxxxxxx wrote:
Hi,
the resource files are described in the GUI section of the C++ SDK docs. There are no differences for Python.
See here:
SDK Docs R15: User Interface
[URL-REMOVED]
[URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.
-
On 08/01/2015 at 05:03, xxxxxxxx wrote:
I am creating a GeDialog window, and cannot use resource files. For that I need to check what Interface Language user is using.
How to do that?Thanks.
-
On 08/01/2015 at 05:18, xxxxxxxx wrote:
Tomas,
I don't understand, why creating a GeDialog window keeps you from using resource strings?
Are you building the GeDialog dynamically? Then you can still use the GeResource class to load your strings. I don't think, this will be more work, than doing the entire localization yourself manually. -
On 08/01/2015 at 05:26, xxxxxxxx wrote:
Well, I'd rather not use resource string, as this code will be shared publicly. And in order to prevent script from crashing, I was hoping to implement localisation right in the code.
So main thing for me is left to catch what Interface Language user is running, and depending on that I would show appropriate string.
-
On 08/01/2015 at 06:39, xxxxxxxx wrote:
As Sebastian pointed out to me, you can use
GeGetLanguage()
[URL-REMOVED].
[URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.
-
On 08/01/2015 at 23:15, xxxxxxxx wrote:
Yes indeed, GeGetLanguage() works as a charm.
Thanks Andreas.