Bram's Dev Blog

home

100 Days of Code Day 99 - Missing messages

10 Dec 2018

Messages missing from automated extraction

On Day 92 I noticed that following messages were missing from the automated extraction:

bitstream-formats.formats.table.supportLevel.0
bitstream-formats.formats.table.supportLevel.1
bitstream-formats.formats.table.supportLevel.2
collection.page.news 
collection.page.license
error.validation.*
home.title

One reason could be that these keys were defined in the catalog, but that the developer who defined them never actually used them. Trying to use search to find where these keys are used.

Case 1 - Dynamically defined message keys

In the first example, bitstream-formats.formats.table.supportLevel.*, the message key is defined dynamically, see the code at bitstream-formats.component.html

It seems here that the component itself is agnostic about how many potential values there can be for the support level, and delegates that all to the messages. In case we would want to offer different functionality depending on the support level, or apply different CSS rendering, it might make more sense that the component itself is aware of these different values.

Case 2 - unused keys

For following keys, I found no use or reference in the code

collection.page.news

On the place where I would expect that key, I’m seeing community.page.news instead, maybe that’s just a typo or maybe I don’t understand the logic properly.

Case 3 - key used, but only gets into translation pipe after parameter is renamed

When someone defines a comcol-page-content component, 2 parameters need to be supplied: a title and a content parameter. They are not translated at that moment.

Only in the actual component itself, that message key is actually put in the translation pipe

This might get addressed by invoking the translation at the point where the message is inserted, rather than in the component when the message is already generic.

Conclusion

There doesn’t seem to be anything wrong with message extraction and there’s usually a good reason why something is not extracted. The examples found, in my opinion, give even stronger motivation to put the (English) messages directly into the code, rather than working with the level of indirection/obscurity introduced by the message keys.

It may also help developers to see immediately when a certain message fiels wrong, for example too long, for a specific place.

Day 100 Plan

No coding. Perform some soul searching. Determine whether to stop or continue, and if continuing, in which shape or form.

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. Look into web.dev from google for this (thank you Philip)

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.