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

Update Liferay.Language.get regex to tolerate line breaks

    Details

      Description

      Problem:

      • We use a regular expression to substitute Liferay.Language.get calls
      • Prettier may break code up across lines if it exceeds a certain length
      • The line breaks prevent the regular expression from matching and the substitution doesn't get performed

      Proposed solution:

      • Update the code that preforms the substitution to tolerate whitespace (including linebreaks and leading indentaion) between the parentheses of the Liferay.Language.get call and its string parameter.

      I believe the pattern in question is here:

      https://github.com/liferay/liferay-portal/blob/ab49e636925d80c3f4f1532618bae55172aaf77c/portal-impl/src/com/liferay/portal/language/LanguageImpl.java#L1977

      For more context and some other possible solutions see:

      https://github.com/brianchandotcom/liferay-portal/pull/74563#issuecomment-502786377

      Note that that PR fixes a few places where `Liferay.Language.get()` calls have been broken up across multiple lines, but a `git grep` shows that there are still others in the codebase. This is pretty high priority. Until we address this issue, Prettier is going to keep putting the line breaks in there and cause substitution to fail, and anywhere where we manually patch it like that PR does, Prettier will just revert it right back on the next SF (unless we add `// prettier-ignore` comments), which we don't want to do.

        Attachments

          Activity

            People

            • Assignee:
              brian.chan Brian Chan
              Reporter:
              greg.hurrell Greg Hurrell
              Recent user:
              Jason Pince
              Participants of an Issue:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Packages

                Version Package
                7.0.0 DXP FP84
                7.0.X
                7.1.X
                7.2.X
                Master