Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-117577

Support localization keys and labels for frontend tokens

    Details

      Description

      We need a way to provide localization labels for token definitions.

      1) One way would be adding the key to a Language.properties file inside the Classic Theme's WAR file.
      2) Another way would be providing an API to retrieve localized TokenDefinitions.

      Solution 1 can be easily implemented by adding a Language.properties file in the Classic Theme's project and tweaking the build so that it is put in the WEB-INF/classes folder of the WAR file. It has to be put in that folder because it's where the Bundle-ClassPath header points to in the MANIFEST.MF file of the generated JAR file (when WabProcessor translates the WAR).

      I tried manipulating the Bundle-ClassPath to add '.' so that we can put 'Language.properties' directly under 'content' in the root of the WAR file but it leads to some errors. Also, there's a comment in WabProcessor which states that the order of the Bundle-ClassPath entries is very important and, given how exotic is having comments in Liferay code, I'm sure it must be something very very important. To finish with, if we don't put 'Language.properties' under any WEB-INF subfolder, it would be visible through the browser which is something probably unwanted.

      Solution 2 would probably rely on solution 1 but giving an API to isolate users from it.

      Basically we would provide a method like `getFrontendTokenDefinition(Locale locale)` which returns the localized version of the `TokenDefinition`.

      We have finally decided to do option 2.

        Attachments

          Activity

            People

            Assignee:
            jose.balsas Chema Balsas
            Reporter:
            ivan.zaera Ivan Zaera
            Engineering Assignee:
            Ivan Zaera
            Recent user:
            Kiyoshi Lee
            Participants of an Issue:
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Packages

                Version Package
                Master