Bram's Dev Blog

home

100 Days of Code Day 69 - Hacktoberfest Finish

31 Oct 2018

Evening session

Even though I did day 68 earlier in the morning, I continued in the evening to anticipate missing friday and to finish my Hacktoberfest pull requests.

Before leaving work

Art gave me a few pointers, including Intellij IDEA shortcuts:

He also recommended me to change the Language representation in the configuration from:

lang: {
    //Default language in case there are no active translations for the user's browser language
    default: 'en',
    //Languages that users can choose from in the language switch
    active: ['en','cs','de'],
    //Labels for the languages that users can choose from in the language switch
    activeLabels: ['English','Čeština','Deutsch'],
    //Languages for which DSpace has translations files, but that are deactivated
    inactive: ['nl'],
    //Labels for deactivated languages
    inactiveLabels: ['Nederlands']
  }

into:

lang: [{
    code: 'en',
    label: 'English',
    active: true,
    default: true
  }, {
    code: 'de',
    label: 'Deutsch',
    active: true
  }, {
    code: 'cs',
    label: 'Čeština',
    active: true
  }, {
    code: 'nl',
    label: 'Nederlands',
    active: false
  }]

This primarily addresses the weakness that the previous configuration really relied on maintaining the exact same order in the language arrays and their corresponding labels, which would become a mess with a big volume of possible languages.

He also helped me to solve the elusive dependency injection problem I was dealing with for the last days. All the time, I was thinking that the following stacktrace didn’t reveal what was missing, but it did:

FAILED TESTS:
  LangSwitchComponent
    ✖ should create
      Chrome 69.0.3497 (Mac OS X 10.12.6)
    Error: StaticInjectorError(DynamicTestModule)[LangSwitchComponent -> InjectionToken config]:
      StaticInjectorError(Platform: core)[LangSwitchComponent -> InjectionToken config]:
        NullInjectorError: No provider for InjectionToken config!

I thought there was something wrong with configuration somewhere, but it turns out that my component needs the variable “config”, where all of the environment.default.js gets loaded. So once that was mocked with a few languages, this hurdle was passed.

Rewriting component

I rewrote the methods in the component to support this new structure. Links that helped me along the way, primarily to get a refresh on .map() and .find().

Stuck on the unit tests

After the dependency injection problem was addressed, I was now confronted with not being able to load the translation files from the assets/resources directory.

Hacktoberfest pull requests

I really wanted to have fully meaningful and big pull requests in there, but as the end of the day, and the end of October Hacktoberfest deadline loomed, I had to settle for two contributions that were a little less challenging in nature:

Day 70 Plan

Find out how to access the language file assets from the unit tests.

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.