Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-26430

Translation dumper to detect strings to translate in .js

    Details

      Description

      EZP-25428 will provide a Translation dumper for strings in our template but we are missing one to extract strings from JavaScript files.

      This is also an opportunity to think about a shorter syntax than Y.eZ.Translator.trans() to translate strings into JavaScript components.

        Issue Links

          Activity

          Hide
          Damien Pobel (Inactive) added a comment - - edited

          Just to sum up an internal discussion. The best way to reliably detect calls to Y.eZ.trans() is probably to use a JavaScript parser from a node script. So basically, for each JavaScript file (potential optimization, this separate process could be launched if we detect the string "Y.eZ.trans" in the code), the dumper would call a node script that would detect Y.eZ.trans() calls with a proper JavaScript parser and report them in an easily usable format so that the PHP script can add the strings to the catalogs.

          There are several available JavaScript parsers but I think https://github.com/eslint/espree is good choice (It is used as a basis for eslint a very popular linter).

          Show
          Damien Pobel (Inactive) added a comment - - edited Just to sum up an internal discussion. The best way to reliably detect calls to Y.eZ.trans() is probably to use a JavaScript parser from a node script. So basically, for each JavaScript file (potential optimization, this separate process could be launched if we detect the string "Y.eZ.trans" in the code), the dumper would call a node script that would detect Y.eZ.trans() calls with a proper JavaScript parser and report them in an easily usable format so that the PHP script can add the strings to the catalogs. There are several available JavaScript parsers but I think https://github.com/eslint/espree is good choice (It is used as a basis for eslint a very popular linter).
          Show
          Yannick Roger (Inactive) added a comment - Added translation shortcut: https://github.com/ezsystems/PlatformUIBundle/commit/19804869410f88815455efddaeb87dec16be3cc9
          Show
          Yannick Roger (Inactive) added a comment - PR: https://github.com/ezsystems/PlatformUIBundle/pull/721
          Hide
          Yannick Roger (Inactive) added a comment -

          To QA: Please also test EZP-26617 along with this issue as the fix for it is in this pull request.

          Show
          Yannick Roger (Inactive) added a comment - To QA: Please also test EZP-26617 along with this issue as the fix for it is in this pull request.
          Hide
          Yannick Roger (Inactive) added a comment -

          While testing EZP-26660 [~damien.pobel@ez.no] ran a lot of testing on this story.

          We will let QA do a global testing of the whole translation process once it is fully implemented and documented.

          Show
          Yannick Roger (Inactive) added a comment - While testing EZP-26660 [~damien.pobel@ez.no] ran a lot of testing on this story. We will let QA do a global testing of the whole translation process once it is fully implemented and documented.
          Show
          Yannick Roger (Inactive) added a comment - Fixed in master: https://github.com/ezsystems/PlatformUIBundle/commit/9381a5c504dd2bec556c8be8ede65ad93da33fe5

            People

            • Assignee:
              Unassigned
              Reporter:
              Damien Pobel (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: