8 Replies Latest reply on Nov 10, 2008 9:47 AM by Stephen Houston

    Localizing Tab that has spaces in its name

    Jean Vence Newbie

      I know how to localize a tab by modifying the Resource_xx.properties file as such:
      PAGENAME_News=News

      but how do I do it with a tab that has a space in its name such as "My Account"

      Tried all possible combination and it did not work
      PAGENAME_My Account=My Account
      PAGENAME_My_Account=My Account
      PAGENAME_MyAccount=My Account

      Any ideas?

      Thanks

      Jean

        • 1. Re: Localizing Tab that has spaces in its name
          Thomas Heute Master

          Yes this was a poorly designed stuff.

          We made changes in that area for 2.6.3.
          You can have display names in the -object.xml descriptor now, we are working on the GUI to let you do it there too.

          Check the dsiplay-name tag here:
          http://anonsvn.jboss.org/repos/portal/branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/data/default-object.xml

          • 2. Re: Localizing Tab that has spaces in its name
            - - Newbie

             

            We made changes in that area for 2.6.3.
            You can have display names in the -object.xml descriptor now, we are working on the GUI to let you do it there too.


            Manage titles localization inside resource bundles seems to me more natural : this is the role of bundles ! -object.xml files should only be used as technical configuration files, shouldn't they ? This is quite unusual in J2EE : you don't manage portlet title localization or portlet preferences localization in portlet.xml for example !

            I'm not bothered by restrictions with object names (like no space character) but by :

            - not being able to localize names using their full path, using object hierarchy, .e.g. : PAGENAME_default.page1.subpage1=xxx
            - having to define localization outside my webapp

            • 3. Re: Localizing Tab that has spaces in its name
              Thomas Heute Master


              The issue is that resource bundles (as file) cannot be changed at runtime, so when you add a page you cannot change it.

              I know both solutions has advantages and drawbacks, we have people only using the dynamicity and users using static content.

              I was also thinking of resource bundles as default values that could be overridden with whatever is in database. Would that fit your use case ?

              portlet.xml is different... It's a deployment feature, not a way to populate data (opposite from -object.xml) so please there is no need for exclamation marks.

              • 4. Re: Localizing Tab that has spaces in its name
                - - Newbie

                 


                The issue is that resource bundles (as file) cannot be changed at runtime, so when you add a page you cannot change it.

                ? But this is the same for -object.xml descriptor, both provide default values ?!


                I was also thinking of resource bundles as default values that could be overridden with whatever is in database. Would that fit your use case ?

                This is what I would expect :-)

                Where would you put bundles ? Could we use hierarchical page keys (e.g. : default.page1.subpage1) ?


                portlet.xml is different... It's a deployment feature, not a way to populate data (opposite from -object.xml) so please there is no need for exclamation marks.

                There was a hidden smile under the exclamation mark, that was not supposed to be rude :-) Even though I think both are descriptors which should not store localization. But this is just my humble opinion...


                • 5. Re: Localizing Tab that has spaces in its name
                  Thomas Heute Master

                   

                  "syllant" wrote:

                  The issue is that resource bundles (as file) cannot be changed at runtime, so when you add a page you cannot change it.

                  ? But this is the same for -object.xml descriptor, both provide default values ?!


                  -object.xml is just there to populate the database. It's very convenient in that sense. But then you can also change your portal objects using the admin portlet.

                  "syllant" wrote:


                  I was also thinking of resource bundles as default values that could be overridden with whatever is in database. Would that fit your use case ?

                  This is what I would expect :-)

                  The reason why i didn't do it is that it can be very confusing. This would update the database, if you redeploy the app with new localized display-name they wouldn't be taken in account unless you use <if-exists>overwrite</if-exists> which is already an issue today for other topics.


                  "syllant" wrote:

                  Where would you put bundles ? Could we use hierarchical page keys (e.g. : default.page1.subpage1) ?

                  The initial idea was to define the resource bundle in the -object.xml descriptor but it means that it would be stored in database (the location of the resource bundle) which sucks.

                  "syllant" wrote:


                  portlet.xml is different... It's a deployment feature, not a way to populate data (opposite from -object.xml) so please there is no need for exclamation marks.

                  There was a hidden smile under the exclamation mark, that was not supposed to be rude :-)

                  I didn't see the hidden smile, i'm glad if we can have constructive discussion. So far i'm satisified with no solution with the current -object.xm descriptors

                  "syllant" wrote:

                  Even though I think both are descriptors which should not store localization. But this is just my humble opinion...


                  Again the descriptors serves totally different goals. JSR-168 spec lets you define localized string either directly in the portlet.xml or in a resource bundle, this is cool. But we cannot do it for a descriptor which is used to populate data that can be modified at runtime and must be persistent.

                  If you have a solution that perfectly fits the use cases i mentioned, i would be glad to hear it.

                  • 6. Re: Localizing Tab that has spaces in its name
                    Thomas Heute Master

                    So i'm implementing it this way.
                    On top of the different display-name i will add a:
                    resource-bundle tag to specify a resource bundle.

                    Values from this resource bundle will populate the database and can be overidden at runtime for people using the admin portlet.

                    If if-exists is set to keep, values from DB are kept, if it's overwrite it will take the values from the resource bundles.

                    That way we have something consistent that solves main use cases.

                    • 7. Re: Localizing Tab that has spaces in its name
                      - - Newbie

                      This seems to be clean :-)

                      But I wish you could redesign -object.xml usage since it's quite confusing.

                      I'm new to JBP (2 weeks) but I've used other portals. What I miss most in JPB is a import/export module (or backup/restore). There should be a way to redeploy a portal with its content easily. This is why probably many of us use -object.xml files, to keep a externalized definition of portal content.

                      But my impression is that these descriptors where designed as bootstrappers, i.e. to quickly build a portal core, and not as whole portal definition. This is why there are design issues like this (tab localization), which don't fit this goal.

                      What I'd like is to keep these descriptors as simple bootstrappers (i.e. without handling localization) and be able to export and import portal : structure, content, configuration, users, ... I've seen this was planned for 2.8, great :-)

                      • 8. Re: Localizing Tab that has spaces in its name
                        Stephen Houston Newbie

                        Under Oracle it doesn't seem like its possible to just use the display-name elements in the deployment descriptor. When doing so you send up with an error

                        2008-11-10 14:17:01,016 DEBUG [org.hibernate.util.JDBCExceptionReporter] Could not execute JDBC batch update [insert into JBP_PORTAL_OBJECT_DNAMES (INSTANCE
                        _PK, LOCALE, TEXT) values (?, ?, ?)]
                        java.sql.BatchUpdateException: ORA-01400: cannot insert NULL into ("FOO"."JBP_PORTAL_OBJECT_DNAMES"."LOCALE")
                        
                         at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
                         at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10768)
                         at org.jboss.resource.adapter.jdbc.WrappedStatement.executeBatch(WrappedStatement.java:774)
                         at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
                         at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
                         at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)
                         at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:145)
                         at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
                         at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41)
                         at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969)
                         at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
                         at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
                         at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:811)
                         at org.jboss.portal.core.impl.model.portal.PersistentPortalObjectContainer.getObjectNodeNoCache(PersistentPortalObjectContainer.java:274)
                         at org.jboss.portal.core.impl.model.portal.PersistentPortalObjectContainer.getObjectNode(PersistentPortalObjectContainer.java:291)
                         at org.jboss.portal.core.impl.model.portal.PersistentPortalObjectContainer.getObjectNode(PersistentPortalObjectContainer.java:252)
                         at org.jboss.portal.core.impl.model.portal.AbstractPortalObjectContainer.setSecurityBindings(AbstractPortalObjectContainer.java:194)
                         at org.jboss.portal.core.model.portal.metadata.PortalObjectMetaData.configure(PortalObjectMetaData.java:234)
                         at org.jboss.portal.core.model.portal.metadata.PortalObjectMetaData.create(PortalObjectMetaData.java:150)
                        

                        It works fine if you use the resource-bundle and supported-locale elements though. Also display-name works fine with mysql, its only when I use oracle that I get the problem.