Bram's Dev Blog

home

100 Days of Code Day 53 - DSpace 7 Language

16 Oct 2018

Action to delete a language from the list

NGX-translate does not advertise a method to remove a language from the list in the documentation. However, even though the list of langs is a private attribute in the translate service, the component does expose a setter that allows you to set the list of languages.

Using that setter, I cooked up following remove method:

   remove (toRemove: string): void {
    let removeIndex = this.translate.getLangs().indexOf(toRemove);
    if (removeIndex > -1) {
      this.translate.langs=this.translate.getLangs().splice(removeIndex, 1);
    }
  }

It definitely does something, but totally not what I expected.

  1. I click the x to remove German.
  2. I open the dropdown again. Instead of seeing the list without German, I ONLY see German.
  3. I switch to another language and open the dropdown again.
  4. The list now correctly shows the languages, without German.

This removal also doesn’t survive a page reload. So my remove method better also persists the change in the configuration.

Day 54 Plan

Continue implementation of the action to deactivate a language.

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

September sustainability challenge - Completed

The money has been wired and I’m closing the books on the September sustainability challenge where I was sponsored for every successful day and where I would punish myself for every missed day.

New sustainability challenge - Finish before Christmas

With today being day 43, there are 57 days of coding left. Setting the goal to get there before Dec 25th gives me a little more flexibility while still requiring a high frequency.

In terms of positive motivator, I’m currently thinking along the lines of a big reward at the end, while at the same time still wondering about something more incremental for Oct/Nov, or to have a self-punishment system in here as well.