Bram's Dev Blog

home

100 Days of Code Day 98 - Po concerns

09 Dec 2018

Wondering about Max line length

The DSpace Code Style guidelines mention a max line length of 120 characters.

However, the aids that it has in place, the tslint config and .editorconfig are currently not enforcing this. Wonder why and will ask my colleagues, as I can’t see a reason for NOT enforcing it if it’s a rule after all.

We had a discussion on this over lunch earlier this week. One of the points that was made there is that automatically cleaning up/making lines shorter doesn’t work, because it’s best that a developer makes a conscious choice about how and where to break the line.

Errors in yesterday’s blog

When writing about escaping in the previous blog, I didn’t take into account that some escaping might had to be in place to make the blog render correctly. Turns out that it’s problematic in several places but not a high priority right now to fix it there. You can always find the raw version of the blog here if you’re interested.

Demonstrator for the context field

In the current approach, where each message has a unique message ID, you can very easily have two different message keys that have the same value. For example, you could assign the string “Home” or “Back” to different message keys for different places where they would be used.

If the message itself will be used as the key, it’s not trivial anymore to have several occurences of the same original message (in English). Gettext and the .po format solve this by the optional parameter msgctxt.

For the demonstrator, I was looking into ways to express context through the translate pipe. Let’s say I have two different places where I want to use the string “Home”, but still allow translators in different languages to have different translation in both of these places

Home
Home

Looking through the documentation, as well as the code of ngx-translate and the additional po loader, I can only conclude that this feature of Gettext/.po is currently not yet supported. However, there seems to be a pull request where it is being introduced:

Retrieve context, comments and reference via translate directive

But if we were to adopt .po right now in DSpace, I think we have to live with the fact that a single original message can only have a single translation right now.

Day 99 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. 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.