title: Angular: most elegant, shortest way to use a translation pipe in your component (TS code)
body: <p>So, I have a translation pipe, is pretty mush self explanatory</p>
  
  <pre><code>import { TranslationService } from 'app/services/translation.service';
  const getByKey = require('lodash.get');
  
  @Pipe({
    name: 'translate'
  })
  export class TranslatePipe implements PipeTransform {
  
    constructor(public _translation: TranslationService) {}
  
    transform(value: string, args?: string): string {
      return getByKey(this._translation.store, value) || args;
    }
  }
  </code></pre>
  
  <p>what I would like is to use this pipe in my components BUT, I would like it to be elegant and not too instrusive</p>
  
  <p>don't want to end up with the code like this:</p>
  
  <pre><code>constructor(private _T: TranslatePipe) {
    ....
    this.testText = this._T.transform('mylong.andlengthy.section.key', 'Fall back english text');
    ....
  }
  </code></pre>
  
  <p>What I would like instead is to do something like</p>
  
  <pre><code>const _T = require('app/pipes/translate.pipe)'; // or something that would work with import
  </code></pre>
  
  <p>on top</p>
  
  <p>and then to use it like</p>
  
  <pre><code>constructor() {
        ....
        this.testText = _T('mylong.andlengthy.section.key', 'Fall back english text');
        ....
      }
  </code></pre>
  
  <p>Any good suggestions</p>