title: How to translate custom pipes in angular using i18n?
body: <p>I am translating my Angular 7 app using i18n and I have custom pipes that produce text. How can I translate the text produced by the pipes?</p>
  
  <p>I stick to the <a href="https://angular.io/guide/i18n" rel="nofollow noreferrer">i18n guideline</a> provided by the angular docs, I use this <a href="https://github.com/martinroob/ngx-i18nsupport/wiki/Tutorial-for-using-xliffmerge-with-angular-cli" rel="nofollow noreferrer">xliff merge strategy</a> for development and I use <a href="https://medium.freecodecamp.org/how-to-implement-localization-in-angular-using-i18n-tools-a88898b1a0d0" rel="nofollow noreferrer">this tutorial</a> for my builds per locale.</p>
  
  <p>For example, I am trying to translate this <a href="https://github.com/AndrewPoyntz/time-ago-pipe/blob/master/time-ago.pipe.ts" rel="nofollow noreferrer">time ago pipe</a> in which numbers are converted to text.</p>
  
  <p>At the moment I have no idea how to translate custom pipes. I only know how to translate html tags using the <code>i18n</code> attribute, which does not seem to be applicable to the custom pipes that I use.</p>
  
  <p>This <a href="https://angular.io/guide/i18n#i18n-pipes" rel="nofollow noreferrer">angular i18n paragraph</a> suggests to set a some kind of global variable in the main <code>app.module.ts</code>, but the examples are a bit scarce and (a) I don't know how to set the locale depending on the build per language as I do following <a href="https://medium.freecodecamp.org/how-to-implement-localization-in-angular-using-i18n-tools-a88898b1a0d0" rel="nofollow noreferrer">this tutorial</a>, (b) I don't know how to get the global locale into my custom pipe and (c) is it possible translate the contents for the pipe in the <code>messages.&lt;locale&gt;.xlf</code> files instead of within the pipe?</p>