You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Rodrigo Castillo <rc...@gmail.com> on 2010/08/30 18:10:54 UTC

Multilanguage resources

Hi, I'm trying to develop my own basic component library over pivot,
but I realize that, the only way to provide multi-language  resources
to components is through wtkxserializer constructor, so if I have a
main window and I want to add a login "component" there are to ways to
complete this as I can see: merge both main windows and login
component json multi-language in only one file (we broke the component
encapsulation) that is should be passed to the "main wtkxserializer",
and loading login component with wtkx:include or wtkx:define, or each,
main window and login component have they own json multi-language file
and also each one should use a separate wtkxserializer  and add
components by some programmatic way, witch is not so complicated but
it requires more control.

Do you know if there is other way to accomplish this?, for example:
pass more than one json file to the wtkxserializer to avoid merge.

Greetings.

Re: Multilanguage resources

Posted by Rodrigo Castillo <rc...@gmail.com>.
Mmm no, I don't wanted exactly hardcode the language in wtkx (sorry
for don't express myself better, i will try if new question arises :D
) , just to know if the resource loaded by the tag wtkx:include
follows some special rule.

I think that wtkx:include is the best choice and will resolves all my problems.

Thanks a lot.

On Mon, Aug 30, 2010 at 5:30 PM, Greg Brown <gk...@mac.com> wrote:
> No, resources loaded by WTKX use the current locale, as returned by java.util.Locale.getDefault(). Hard-coding a locale in the file would sort of defeat the purpose of localizing it.  ;-)
>
> Though you can't do it in WTKX, you can do it in code - though I'm curious to know why you would want to?
>
> On Aug 30, 2010, at 6:21 PM, Rodrigo Castillo wrote:
>
>> Sure.
>>
>> For example, following  your code:
>>
>> <foo:MainWindow xmlns:wtkx="http://pivot.apache.org/wtkx"
>>    xmlns:foo="com.foo">
>>    <wtkx:define>
>>        <wtkx:include wtkx:id="loginDialog" src="login_dialog.wtkx"
>> resources="com.foo.LoginDialog"/>
>>    </wtkx:define>
>> </MainWindow>
>>
>> is there a way to dictate what language should be used for
>> login_dialog.wtkx? for example the json file
>> com.foo.LoginDialog_cn.json or com.foo.LoginDialog_it.json
>>
>> Thanks again.
>>
>> On Mon, Aug 30, 2010 at 4:55 PM, Greg Brown <gk...@mac.com> wrote:
>>> I'm sorry but I don't understand the question. Can you provide more context?
>>> G
>>>
>>> On Aug 30, 2010, at 4:55 PM, Rodrigo Castillo wrote:
>>>
>>>> Looks great.
>>>>
>>>> Just a couple questions before I check the src code, is it possible to
>>>> localize this attribute resource string/url (checking the api 1.5.1,
>>>> may be using some of the multiple language attribute in WTKXSerializer
>>>> class) ?, or will it just take the resource that you are coding in?
>>>>
>>>> Thanks a lot
>>>>
>>>> On Mon, Aug 30, 2010 at 12:18 PM, Greg Brown <gk...@mac.com> wrote:
>>>>> An include with its own resource file is probably the best way to define your login dialog:
>>>>>
>>>>> <foo:MainWindow xmlns:wtkx="http://pivot.apache.org/wtkx"
>>>>>    xmlns:foo="com.foo">
>>>>>    <wtkx:define>
>>>>>        <wtkx:include wtkx:id="loginDialog" src="login_dialog.wtkx" resources="com.foo.LoginDialog"/>
>>>>>    </wtkx:define>
>>>>> </MainWindow>
>>>>>
>>>>> On Aug 30, 2010, at 12:10 PM, Rodrigo Castillo wrote:
>>>>>
>>>>>> Hi, I'm trying to develop my own basic component library over pivot,
>>>>>> but I realize that, the only way to provide multi-language  resources
>>>>>> to components is through wtkxserializer constructor, so if I have a
>>>>>> main window and I want to add a login "component" there are to ways to
>>>>>> complete this as I can see: merge both main windows and login
>>>>>> component json multi-language in only one file (we broke the component
>>>>>> encapsulation) that is should be passed to the "main wtkxserializer",
>>>>>> and loading login component with wtkx:include or wtkx:define, or each,
>>>>>> main window and login component have they own json multi-language file
>>>>>> and also each one should use a separate wtkxserializer  and add
>>>>>> components by some programmatic way, witch is not so complicated but
>>>>>> it requires more control.
>>>>>>
>>>>>> Do you know if there is other way to accomplish this?, for example:
>>>>>> pass more than one json file to the wtkxserializer to avoid merge.
>>>>>>
>>>>>> Greetings.
>>>>>
>>>>>
>>>
>>>
>
>

Re: Multilanguage resources

Posted by Greg Brown <gk...@mac.com>.
No, resources loaded by WTKX use the current locale, as returned by java.util.Locale.getDefault(). Hard-coding a locale in the file would sort of defeat the purpose of localizing it.  ;-)  

Though you can't do it in WTKX, you can do it in code - though I'm curious to know why you would want to?

On Aug 30, 2010, at 6:21 PM, Rodrigo Castillo wrote:

> Sure.
> 
> For example, following  your code:
> 
> <foo:MainWindow xmlns:wtkx="http://pivot.apache.org/wtkx"
>    xmlns:foo="com.foo">
>    <wtkx:define>
>        <wtkx:include wtkx:id="loginDialog" src="login_dialog.wtkx"
> resources="com.foo.LoginDialog"/>
>    </wtkx:define>
> </MainWindow>
> 
> is there a way to dictate what language should be used for
> login_dialog.wtkx? for example the json file
> com.foo.LoginDialog_cn.json or com.foo.LoginDialog_it.json
> 
> Thanks again.
> 
> On Mon, Aug 30, 2010 at 4:55 PM, Greg Brown <gk...@mac.com> wrote:
>> I'm sorry but I don't understand the question. Can you provide more context?
>> G
>> 
>> On Aug 30, 2010, at 4:55 PM, Rodrigo Castillo wrote:
>> 
>>> Looks great.
>>> 
>>> Just a couple questions before I check the src code, is it possible to
>>> localize this attribute resource string/url (checking the api 1.5.1,
>>> may be using some of the multiple language attribute in WTKXSerializer
>>> class) ?, or will it just take the resource that you are coding in?
>>> 
>>> Thanks a lot
>>> 
>>> On Mon, Aug 30, 2010 at 12:18 PM, Greg Brown <gk...@mac.com> wrote:
>>>> An include with its own resource file is probably the best way to define your login dialog:
>>>> 
>>>> <foo:MainWindow xmlns:wtkx="http://pivot.apache.org/wtkx"
>>>>    xmlns:foo="com.foo">
>>>>    <wtkx:define>
>>>>        <wtkx:include wtkx:id="loginDialog" src="login_dialog.wtkx" resources="com.foo.LoginDialog"/>
>>>>    </wtkx:define>
>>>> </MainWindow>
>>>> 
>>>> On Aug 30, 2010, at 12:10 PM, Rodrigo Castillo wrote:
>>>> 
>>>>> Hi, I'm trying to develop my own basic component library over pivot,
>>>>> but I realize that, the only way to provide multi-language  resources
>>>>> to components is through wtkxserializer constructor, so if I have a
>>>>> main window and I want to add a login "component" there are to ways to
>>>>> complete this as I can see: merge both main windows and login
>>>>> component json multi-language in only one file (we broke the component
>>>>> encapsulation) that is should be passed to the "main wtkxserializer",
>>>>> and loading login component with wtkx:include or wtkx:define, or each,
>>>>> main window and login component have they own json multi-language file
>>>>> and also each one should use a separate wtkxserializer  and add
>>>>> components by some programmatic way, witch is not so complicated but
>>>>> it requires more control.
>>>>> 
>>>>> Do you know if there is other way to accomplish this?, for example:
>>>>> pass more than one json file to the wtkxserializer to avoid merge.
>>>>> 
>>>>> Greetings.
>>>> 
>>>> 
>> 
>> 


Re: Multilanguage resources

Posted by Rodrigo Castillo <rc...@gmail.com>.
Sure.

For example, following  your code:

<foo:MainWindow xmlns:wtkx="http://pivot.apache.org/wtkx"
    xmlns:foo="com.foo">
    <wtkx:define>
        <wtkx:include wtkx:id="loginDialog" src="login_dialog.wtkx"
resources="com.foo.LoginDialog"/>
    </wtkx:define>
</MainWindow>

is there a way to dictate what language should be used for
login_dialog.wtkx? for example the json file
com.foo.LoginDialog_cn.json or com.foo.LoginDialog_it.json

Thanks again.

On Mon, Aug 30, 2010 at 4:55 PM, Greg Brown <gk...@mac.com> wrote:
> I'm sorry but I don't understand the question. Can you provide more context?
> G
>
> On Aug 30, 2010, at 4:55 PM, Rodrigo Castillo wrote:
>
>> Looks great.
>>
>> Just a couple questions before I check the src code, is it possible to
>> localize this attribute resource string/url (checking the api 1.5.1,
>> may be using some of the multiple language attribute in WTKXSerializer
>> class) ?, or will it just take the resource that you are coding in?
>>
>> Thanks a lot
>>
>> On Mon, Aug 30, 2010 at 12:18 PM, Greg Brown <gk...@mac.com> wrote:
>>> An include with its own resource file is probably the best way to define your login dialog:
>>>
>>> <foo:MainWindow xmlns:wtkx="http://pivot.apache.org/wtkx"
>>>    xmlns:foo="com.foo">
>>>    <wtkx:define>
>>>        <wtkx:include wtkx:id="loginDialog" src="login_dialog.wtkx" resources="com.foo.LoginDialog"/>
>>>    </wtkx:define>
>>> </MainWindow>
>>>
>>> On Aug 30, 2010, at 12:10 PM, Rodrigo Castillo wrote:
>>>
>>>> Hi, I'm trying to develop my own basic component library over pivot,
>>>> but I realize that, the only way to provide multi-language  resources
>>>> to components is through wtkxserializer constructor, so if I have a
>>>> main window and I want to add a login "component" there are to ways to
>>>> complete this as I can see: merge both main windows and login
>>>> component json multi-language in only one file (we broke the component
>>>> encapsulation) that is should be passed to the "main wtkxserializer",
>>>> and loading login component with wtkx:include or wtkx:define, or each,
>>>> main window and login component have they own json multi-language file
>>>> and also each one should use a separate wtkxserializer  and add
>>>> components by some programmatic way, witch is not so complicated but
>>>> it requires more control.
>>>>
>>>> Do you know if there is other way to accomplish this?, for example:
>>>> pass more than one json file to the wtkxserializer to avoid merge.
>>>>
>>>> Greetings.
>>>
>>>
>
>

Re: Multilanguage resources

Posted by Greg Brown <gk...@mac.com>.
I'm sorry but I don't understand the question. Can you provide more context?
G

On Aug 30, 2010, at 4:55 PM, Rodrigo Castillo wrote:

> Looks great.
> 
> Just a couple questions before I check the src code, is it possible to
> localize this attribute resource string/url (checking the api 1.5.1,
> may be using some of the multiple language attribute in WTKXSerializer
> class) ?, or will it just take the resource that you are coding in?
> 
> Thanks a lot
> 
> On Mon, Aug 30, 2010 at 12:18 PM, Greg Brown <gk...@mac.com> wrote:
>> An include with its own resource file is probably the best way to define your login dialog:
>> 
>> <foo:MainWindow xmlns:wtkx="http://pivot.apache.org/wtkx"
>>    xmlns:foo="com.foo">
>>    <wtkx:define>
>>        <wtkx:include wtkx:id="loginDialog" src="login_dialog.wtkx" resources="com.foo.LoginDialog"/>
>>    </wtkx:define>
>> </MainWindow>
>> 
>> On Aug 30, 2010, at 12:10 PM, Rodrigo Castillo wrote:
>> 
>>> Hi, I'm trying to develop my own basic component library over pivot,
>>> but I realize that, the only way to provide multi-language  resources
>>> to components is through wtkxserializer constructor, so if I have a
>>> main window and I want to add a login "component" there are to ways to
>>> complete this as I can see: merge both main windows and login
>>> component json multi-language in only one file (we broke the component
>>> encapsulation) that is should be passed to the "main wtkxserializer",
>>> and loading login component with wtkx:include or wtkx:define, or each,
>>> main window and login component have they own json multi-language file
>>> and also each one should use a separate wtkxserializer  and add
>>> components by some programmatic way, witch is not so complicated but
>>> it requires more control.
>>> 
>>> Do you know if there is other way to accomplish this?, for example:
>>> pass more than one json file to the wtkxserializer to avoid merge.
>>> 
>>> Greetings.
>> 
>> 


Re: Multilanguage resources

Posted by Rodrigo Castillo <rc...@gmail.com>.
Looks great.

Just a couple questions before I check the src code, is it possible to
localize this attribute resource string/url (checking the api 1.5.1,
may be using some of the multiple language attribute in WTKXSerializer
class) ?, or will it just take the resource that you are coding in?

Thanks a lot

On Mon, Aug 30, 2010 at 12:18 PM, Greg Brown <gk...@mac.com> wrote:
> An include with its own resource file is probably the best way to define your login dialog:
>
> <foo:MainWindow xmlns:wtkx="http://pivot.apache.org/wtkx"
>    xmlns:foo="com.foo">
>    <wtkx:define>
>        <wtkx:include wtkx:id="loginDialog" src="login_dialog.wtkx" resources="com.foo.LoginDialog"/>
>    </wtkx:define>
> </MainWindow>
>
> On Aug 30, 2010, at 12:10 PM, Rodrigo Castillo wrote:
>
>> Hi, I'm trying to develop my own basic component library over pivot,
>> but I realize that, the only way to provide multi-language  resources
>> to components is through wtkxserializer constructor, so if I have a
>> main window and I want to add a login "component" there are to ways to
>> complete this as I can see: merge both main windows and login
>> component json multi-language in only one file (we broke the component
>> encapsulation) that is should be passed to the "main wtkxserializer",
>> and loading login component with wtkx:include or wtkx:define, or each,
>> main window and login component have they own json multi-language file
>> and also each one should use a separate wtkxserializer  and add
>> components by some programmatic way, witch is not so complicated but
>> it requires more control.
>>
>> Do you know if there is other way to accomplish this?, for example:
>> pass more than one json file to the wtkxserializer to avoid merge.
>>
>> Greetings.
>
>

Re: Multilanguage resources

Posted by Greg Brown <gk...@mac.com>.
An include with its own resource file is probably the best way to define your login dialog:

<foo:MainWindow xmlns:wtkx="http://pivot.apache.org/wtkx"
    xmlns:foo="com.foo">
    <wtkx:define>
        <wtkx:include wtkx:id="loginDialog" src="login_dialog.wtkx" resources="com.foo.LoginDialog"/>
    </wtkx:define>
</MainWindow>

On Aug 30, 2010, at 12:10 PM, Rodrigo Castillo wrote:

> Hi, I'm trying to develop my own basic component library over pivot,
> but I realize that, the only way to provide multi-language  resources
> to components is through wtkxserializer constructor, so if I have a
> main window and I want to add a login "component" there are to ways to
> complete this as I can see: merge both main windows and login
> component json multi-language in only one file (we broke the component
> encapsulation) that is should be passed to the "main wtkxserializer",
> and loading login component with wtkx:include or wtkx:define, or each,
> main window and login component have they own json multi-language file
> and also each one should use a separate wtkxserializer  and add
> components by some programmatic way, witch is not so complicated but
> it requires more control.
> 
> Do you know if there is other way to accomplish this?, for example:
> pass more than one json file to the wtkxserializer to avoid merge.
> 
> Greetings.