Details

    • Type: Bug Bug
    • Status: Closed
    • Resolution: No Longer Reproducible
    • Affects Version/s: 6.1.0 CE RC1
    • Fix Version/s: None
    • Component/s: UI Infrastructure
    • Labels:
      None
    • Environment:
      LR Revision 69944 , Firefox, chrome, opera
    • Similar Issues:
      Show 5 results 

      Description

      Hi, localization via liferay-ui:message works fine for me, but Liferay.Language.get( ) does not. I always get a response with the "key" instead of "value". So that

      Liferay.Language.get("my.key")) returns "my.key"

      I spent 2 hours already figuring that out, but without success. I checked it is the correct locale.

        Activity

        Hide
        Jakub Liska added a comment -

        Guys it really doesn't work for me. It works fine when calling Portal context, but not portlet context. There is nothing to be misconfigured as to resource bundles in my case. It is pretty straightforward. The only plugin where this is used is Mail plugin. It obviously work there, but I'm thinking whether there is something that must be done for it to work. Because setting up portlet.xml for portlet localization works only for JSP tag liferay-ui:message. The javascript calls don't get into my portlet context.

        Show
        Jakub Liska added a comment - Guys it really doesn't work for me. It works fine when calling Portal context, but not portlet context. There is nothing to be misconfigured as to resource bundles in my case. It is pretty straightforward. The only plugin where this is used is Mail plugin. It obviously work there, but I'm thinking whether there is something that must be done for it to work. Because setting up portlet.xml for portlet localization works only for JSP tag liferay-ui:message. The javascript calls don't get into my portlet context.
        Hide
        Jakub Liska added a comment -

        I had some time to come back to it. The problem is, that after the request hits LanguageServlet and its "LanguageUtil.get(locale, key);" method, in LanguageImpl class, there is following snippet of code, that takes care of loading portlet properties :

        portletConfig = (PortletConfig)request.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG);

        if (portletConfig != null) {
        ResourceBundle resourceBundle = portletConfig.getResourceBundle(locale);

        try

        { value = resourceBundle.getString(key); }

        But portletConfig is null...in that case it searches through portal Language resources only, otherwise returns the "key" value... I sense it could be problem in 6.1.x LR version

        Show
        Jakub Liska added a comment - I had some time to come back to it. The problem is, that after the request hits LanguageServlet and its "LanguageUtil.get(locale, key);" method, in LanguageImpl class, there is following snippet of code, that takes care of loading portlet properties : portletConfig = (PortletConfig)request.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG); if (portletConfig != null) { ResourceBundle resourceBundle = portletConfig.getResourceBundle(locale); try { value = resourceBundle.getString(key); } But portletConfig is null...in that case it searches through portal Language resources only, otherwise returns the "key" value... I sense it could be problem in 6.1.x LR version
        Hide
        Jakub Liska added a comment -

        Omg this issue makes me crazy.

        I just tested the Mail-portlet, and there is main.js that contains "Liferay.Language.get('add-account')" for instance, when add account button is clicked (the dialog is localized). The LanguageServlet should get called as in case of my portlet, but it is not (I have a breakpoint there) and despite it, the message is localized, what kind of magic is this...

        Show
        Jakub Liska added a comment - Omg this issue makes me crazy. I just tested the Mail-portlet, and there is main.js that contains "Liferay.Language.get('add-account')" for instance, when add account button is clicked (the dialog is localized). The LanguageServlet should get called as in case of my portlet, but it is not (I have a breakpoint there) and despite it, the message is localized, what kind of magic is this...
        Show
        Jakub Liska added a comment - http://www.liferay.com/community/forums/-/message_boards/message/7593698
        Hide
        Jakub Liska added a comment -
        Show
        Jakub Liska added a comment - RESOLVED: http://issues.liferay.com/browse/LPS-16513

          People

          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since last comment:
              4 years, 15 weeks, 5 days ago

              Development

                Structure Helper Panel