I want to make a plug in ready to get translated.
I found this url=http://www.eventghost.org/wiki_old/inde ... nalization]wiki entry[[/url] but I only see the name and description of the actions and the plug in itself in the translate dialog. What am I missing?
Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
Plug in Internationalization
- Bitmonster
- Site Admin
- Posts: 2239
- Joined: Mon Feb 06, 2006 10:28 pm
Re: Plug in Internationalization
Do you have an example source?
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
Re: Plug in Internationalization
It is the FS20PCS plug in in the svn
http://www.eventghost.org/svn/trunk/plu ... _init__.py
It has a lot of dynamic classes and two special classes working slightly different.
P.S.
It would be great if you could upload a new beta including the plugin since the first devices will ship this week.
http://www.eventghost.org/svn/trunk/plu ... _init__.py
It has a lot of dynamic classes and two special classes working slightly different.
P.S.
It would be great if you could upload a new beta including the plugin since the first devices will ship this week.
- Bitmonster
- Site Admin
- Posts: 2239
- Joined: Mon Feb 06, 2006 10:28 pm
Re: Plug in Internationalization
Strings are only translatable, if they are inside a "text" class attribute of the action/plugin (with the exception of the name and description fields, that are automatically merged into such class).
So you have to do something like:
and then in your action:
So you have to do something like:
Code: Select all
def AddNewAction(self, root, internalName, baseClass, classFuncCode, externalName, classDescription, classLabelFormat):
class MyText:
labelFormat = classLabelFormat
class tmpAction(baseClass):
text = MyText
name = externalName
description = classDescription
funcCode = classFuncCode
tmpAction.__name__ = internalName
root.AddAction(tmpAction)
Code: Select all
class SimpleAction(ActionBase):
"""Base class for all action that only take an address as input
"""
def GetLabel(self, address):
return self.text.labelFormat.format(GetStringFromAddress(address, True))
^^^^
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
Re: Plug in Internationalization
thx works for most situations but I am not able to translate the commen texts defined in the base classes ActionBase.
If I revert using the common Text class in the file I can see the attributes in the language editor.
If I define text = Text in the base classes the text attribute gets reassigned with the dynamicly created one and I cannot cannot access the attributes from the global text.
If I directly access the Text class in the base class the original text is always shown.
I think I understand what happens, but don't know how do it right.
I am refering to the address, timerValue,.. attributes (see updated file in svn)
If I revert using the common Text class in the file I can see the attributes in the language editor.
If I define text = Text in the base classes the text attribute gets reassigned with the dynamicly created one and I cannot cannot access the attributes from the global text.
If I directly access the Text class in the base class the original text is always shown.
I think I understand what happens, but don't know how do it right.
I am refering to the address, timerValue,.. attributes (see updated file in svn)
- Bitmonster
- Site Admin
- Posts: 2239
- Joined: Mon Feb 06, 2006 10:28 pm
Re: Plug in Internationalization
If the strings are defined in the plugin's "text" class, you have to access them through the plugin.
Code: Select all
panel.AddLine(self.plugin.text.timerValue, timerCtrl)
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!