Ah, i did not see this first. Although it's true in making a new class you would have to subclass each existing component, you could as easily write something like

<button name="submit" text="$path{localized:/submittext}"/>

and still merely swap datasets dynamically to alter text at runtime?

cem sonmez wrote:
hi all
I am tring to do some operations about internationalization. And I am a bit confused how to manage this.

assume this xml :
*words.xml*
-----------------
<words>
    <word id="1" name="hi">
        <value>hello</value>
    </word>
    <word id="2" name="hi">
        <value>merhaba</value>
    </word>
</words>

and dataset for it :

<dataset name="dset" src="words.xml" />

and i want to change any buttons text depend on the datapointer(for *id*) of dset. So, i am planning to do this via declaring a label attribute of the components and implementing a setter for this attribute that is going to be set by the datapointer value. And to do this, i have to add these like lines to any component that i will use.

<attribute name="label" type="number" setter="setLabel(labelId)" />
<method name="setLabel" args="labelId" >
     this.label = labelId;
this.setAttribute('text',canvas.getLabelName(this.label)()); <!--coming from the datapointer as the value of the given id-->
</method>
As a result :)

To do this, I have to do this implementation in each component class definition(i.e button, text, window). My question is : has anyone have an idea how can i manage to do this in an easier way. just this way come to my mind.

Thanks in advance
Regards
--
Cem SONMEZ

Reply via email to