Bram's Dev Blog

home

100 Days of Code Day 92 - Message extract

29 Nov 2018

Transform current JSON catalog and translations to .po

On Day 91, I established that the current message keys and their translations can be loaded with the .po format and the .po loader.

Instead of manually re-writing the catalogs to update them to the new format, I want to see if I can do it automatically, using NGX-Translate-Extract

Fix version number of dependency?

Last time I used IDEA’s suggestion to add @biesbjerg/ngx-translate-po-http-loader as a dependency to package.json. I now saw that it has done this without a specific version:

"@biesbjerg/ngx-translate-po-http-loader": "latest"

Likely it’s better to pin down the version, but when I look at the tags in that repository, the 2.0.1 tag dates from november 2017, even though there have been commits on master this august.

So for now, I’m keeping this at latest but this probably still has to be pinned down going forward.

Reverting to an older version of extract

Ran into SyntaxError - Unmatched selector #87 and resolved it as suggested by pinning down version 2.3.2 of ngx-translate-extract

The extraction worked. At the moment it doesn’t retrieve the source code reference yet, for which the .po format has support in the #: comments, but this functionality has already been proposed in PR 102 for ngx-translate-extract.

Message IDs not extracted

From the following piece:

      "bitstream-formats": {
        "title": "DSpace Angular :: Bitstream Format Registry",
        "head": "Bitstream Format Registry",
        "description": "This list of bitstream formats provides information about known formats and their support level.",
        "formats": {
          "table": {
            "name": "Name",
            "mimetype": "MIME Type",
            "supportLevel": {
              "head": "Support Level",
              "0": "Unknown",
              "1": "Known",
              "2": "Support"
            },
            "internal": "internal"
          },
          "no-items": "No bitstream formats to show."
        }
      }

Those message ids ending in 0, 1 and 2 were not extracted automatically. To be investigated in the code if they are perhaps not used at the moment.

Same goes for collection.page.news, collection.page.license, error.validation.*, home.title

Day 93 Plan

Investigate why some message keys were missing from the automated extraction.

Future days - DSpace 7 Angular

Future days - Analyzer.atmire.com work

Future Days - Productivity

Future days - Jekyll http://bram-atmire.github.io/ site

Future Days - Atmire.com work

Investigate and work on search engine optimization (SEO) for the main atmire.com website.

Future Days - Learning just for learning

Sustainability challenge - Finish before Christmas

If I continue like October, I could hit day 68 by end of October and day 98 by end of November.