i18n menu macro

5 Messages Forum Options Options
Permalink
getagrip
i18n menu macro
Reply Threaded More
Print post
Permalink
Hi, is it be possible to internationalize the menu.xml file to get i18n
navigation, so that instead of having:

<menu label="Home" path=...

I would have something like this:

<menu label="$messages.Home" path=...

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Click-user mailing list
Click-user@...
https://lists.sourceforge.net/lists/listinfo/click-user
sabob
Re: i18n menu macro
Reply Threaded More
Print post
Permalink
Hi,

Its not supported directly, but you could make it work in a custom
Menu by using the label from menu.xml as the key:

public class I18nMenu extends Menu {

   public String getLabel() {
     if (label == null) {
       return null;
     }
     return getMessage(label);
   }
}

<menu label="key" path=...

and host the properties in I18nMenu.properties


getagrip wrote:

> Hi, is it be possible to internationalize the menu.xml file to get i18n
> navigation, so that instead of having:
>
> <menu label="Home" path=...
>
> I would have something like this:
>
> <menu label="$messages.Home" path=...
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Click-user mailing list
Click-user@...
https://lists.sourceforge.net/lists/listinfo/click-user
getagrip
Re: i18n menu macro
Reply Threaded More
Print post
Permalink
Menu.getRootMenu() returns a Menu instance which cannot be casted to any
subclass (I18nMenu), of course.
So I'll write my own menu-renderer.

bob wrote:

> Hi,
>
> Its not supported directly, but you could make it work in a custom
> Menu by using the label from menu.xml as the key:
>
> public class I18nMenu extends Menu {
>
>    public String getLabel() {
>      if (label == null) {
>        return null;
>      }
>      return getMessage(label);
>    }
> }
>
> <menu label="key" path=...
>
> and host the properties in I18nMenu.properties
>
>
> getagrip wrote:
>> Hi, is it be possible to internationalize the menu.xml file to get i18n
>> navigation, so that instead of having:
>>
>> <menu label="Home" path=...
>>
>> I would have something like this:
>>
>> <menu label="$messages.Home" path=...
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>> Build the coolest Linux based applications with Moblin SDK & win great prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Click-user mailing list
> Click-user@...
> https://lists.sourceforge.net/lists/listinfo/click-user

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Click-user mailing list
Click-user@...
https://lists.sourceforge.net/lists/listinfo/click-user
Malcolm Edgar-2
Re: i18n menu macro
Reply Threaded More
Print post
Permalink
Some people at work have been doing some work with Ageci and creating
an AgeciMenu subclass. In this scenario a MenuFactory class would be
very useful.

regards Malcolm Edgar

On Mon, Aug 4, 2008 at 8:16 AM, getagrip <getagrip@...> wrote:

> Menu.getRootMenu() returns a Menu instance which cannot be casted to any
> subclass (I18nMenu), of course.
> So I'll write my own menu-renderer.
>
> bob wrote:
>> Hi,
>>
>> Its not supported directly, but you could make it work in a custom
>> Menu by using the label from menu.xml as the key:
>>
>> public class I18nMenu extends Menu {
>>
>>    public String getLabel() {
>>      if (label == null) {
>>        return null;
>>      }
>>      return getMessage(label);
>>    }
>> }
>>
>> <menu label="key" path=...
>>
>> and host the properties in I18nMenu.properties
>>
>>
>> getagrip wrote:
>>> Hi, is it be possible to internationalize the menu.xml file to get i18n
>>> navigation, so that instead of having:
>>>
>>> <menu label="Home" path=...
>>>
>>> I would have something like this:
>>>
>>> <menu label="$messages.Home" path=...
>>>
>>> -------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>>> Build the coolest Linux based applications with Moblin SDK & win great prizes
>>> Grand prize is a trip for two to an Open Source event anywhere in the world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>> Build the coolest Linux based applications with Moblin SDK & win great prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Click-user mailing list
>> Click-user@...
>> https://lists.sourceforge.net/lists/listinfo/click-user
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Click-user mailing list
> Click-user@...
> https://lists.sourceforge.net/lists/listinfo/click-user
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Click-user mailing list
Click-user@...
https://lists.sourceforge.net/lists/listinfo/click-user
sabob
Re: i18n menu macro
Reply Threaded More
Print post
Permalink
In reply to this post by getagrip
getagrip wrote:
> Menu.getRootMenu() returns a Menu instance which cannot be casted to any
> subclass (I18nMenu), of course.
> So I'll write my own menu-renderer.


Oops you are right. I often have to create menus from RDBMS so I
created a custom FlexiMenu and don't normally have this problem.

Perhaps you can find some inspiration for custom rendering here:

http://code.google.com/p/clickclick/source/browse/trunk/clickclick/core/src/net/sf/clickclick/control/menu/FlexiMenu.java

And example of how to use this menu:

http://code.google.com/p/clickclick/source/browse/trunk/clickclick/core-examples/src/net/sf/clickclick/examples/nav/MenuBuilder.java

You can even see a screenshot of the menu in action ;-)

http://code.google.com/p/clickclick/

kind regards

bob

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Click-user mailing list
Click-user@...
https://lists.sourceforge.net/lists/listinfo/click-user