{"id":2169,"date":"2020-01-07T13:09:57","date_gmt":"2020-01-07T12:09:57","guid":{"rendered":"https:\/\/www.thecodecampus.de\/blog\/?p=2169"},"modified":"2025-04-22T10:23:54","modified_gmt":"2025-04-22T08:23:54","slug":"using-pipes-with-ngx-translate","status":"publish","type":"post","link":"https:\/\/www.thecodecampus.de\/blog\/using-pipes-with-ngx-translate\/","title":{"rendered":"Using pipes with ngx-translate"},"content":{"rendered":"<p><a href=\"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2020\/01\/languages.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2232\" src=\"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2020\/01\/languages.png\" alt=\"\" width=\"1058\" height=\"595\" srcset=\"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2020\/01\/languages.png 1058w, https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2020\/01\/languages-300x169.png 300w, https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2020\/01\/languages-768x432.png 768w, https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2020\/01\/languages-1024x576.png 1024w\" sizes=\"auto, (max-width: 1058px) 100vw, 1058px\" \/><\/a><\/p>\n<p>Angular delivers it&#8217;s own i18n (internationalizion) API. Although the implementation is already very extensive and mature, some use cases are not covered. This also includes changing the language at run-time. When implementing Angular, a build must exist for each language. To close this gap, packages have been created that extend the functionality. A representative of this is ngx-translate, which we want to discuss in more detail in this post.<\/p>\n<p style=\"padding: 2px 6px 4px; color: #555555; background-color: #eeeeee; border: 2px solid #dddddd; text-align: justify;\"><strong>tl;dr<\/strong><br \/>\nEven though Angular delivers it&#8217;s own i18n (internationalizion) API, the ngx-translate module is part of most Angular-developers toolkit. While the built-in capabilities of Angular try<br \/>\nto cover broader and more complex use-cases, ngx-translate helps to fill the gaps. In this post we have a look at the main use-case, where ngx-translate is superior: changing the language of an application at run-time. This fix comes with a cost though. The Angular pipes and especially the date-pipe don&#8217;t respond to the ngx-translate package. As workaround you can use a proxy pipe that extends the functionality and reestablishes the familiar behavior.<\/p>\n<h3>What&#8217;s the Problem?<\/h3>\n<p>When using Angular&#8217;s API the application can adapt to the browsers LOCALE_ID. For this to happen, the application has to be rebuild though.\u00a0 When the use of multiple languages is used frequently, unpredictable or in the same session, this is can make the experience more than unpleasant. Luckily we can work around that shortcoming, using ngx-translate. The module makes it possible to switch between different languages as often and whenever you like. Without interrupting the workflow or rebuilding the Application. So far so good! There is one problem though. Using ngx-translate will not be recognized by all the nice pipes angular delivers us. Especially annoying is this behaviour when using the datepipe.<\/p>\n<p>So is there an opportunity to use the advantages of ngx-translate and still be able to enjoy the convenience of the datepipe? Yes there is, let&#8217;s have a look how to manage it.<\/p>\n<h3>Using i18n API of Angular<\/h3>\n<p>First let&#8217;s have a look at the use of Angular&#8217;s i18n API. The built-in implementation relies on the use of the LOCALE_ID, which is consumed by dependency injection. You can set the LOCALE_ID by using providers as a container for the window.navigator.language value of the browser. This can be declared in the NgModule metadata of the appModule ( or any Child-Module you need to use it in). The following code-snippet shows an implementation:<\/p>\n<pre class=\"lang:js decode:true\">import { LOCALE_ID } from '@angular\/core';\r\nimport { AppComponent } from '.\/app.component';\r\n\r\n@NgModule({\r\n    declarations: [],\r\n    imports: [],\r\n    bootstrap: AppComponent,\r\n    providers: [\r\n        { provide: LOCALE_ID, useValue: window.navigator.language }\r\n    ]\r\n})\r\nexport class AppModule {\r\n}<\/pre>\n<p>Therefore the language is set according to the client&#8217;s browser language when building the app &#8211; and only when building the app. So unfortunately when we want to change the language on run-time, we are stuck. We would have to rebuild the app every time we want to change the language settings. this might be acceptable for apps, that a seldomly used in different languages or have different builds for different countries. But if we want to create one application, that is used globally and concurrently by user of different nationalities, we run into heavy UX problems. Luckily\u00a0 <a href=\"https:\/\/github.com\/ngx-translate\/core\/issues\/783\">Oliver Combe<\/a>, the creator of the ngx-translate package, supplied us with a solution. Until <a href=\"https:\/\/twitter.com\/ocombe\/status\/1148274119609335813?lang=de\">recently<\/a> he was working for Angular to incorporate the capabilities of his package into the build-in API, but for now it is not part of the API.<\/p>\n<p><a href=\"https:\/\/www.thecodecampus.de\/schulungen\/angular\" style=\"display: inline-block;\">\n<picture><source srcset=\"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2025\/04\/schulungen-tcc_sascha_WP_big.png\" media=\"(min-width: 1024px)\"><source srcset=\"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2025\/04\/schulungen-tcc_sascha_WP_medium.png\" media=\"(min-width: 600px)\"><img decoding=\"async\" src=\"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2025\/04\/schulungen-tcc_sascha_WP_small.png\" alt=\"Angular Schulungen\" class=\"alignnone size-full wp-image-38\">\n<\/picture>\n<\/a><\/p>\n<h3>Using ngx-translate<\/h3>\n<p>So first let&#8217;s have a look at the basic usage of ngx-translate. We created a very basic app for demonstration purposes\u00a0 with just one component, that shows the date of our next training (just the current date) and an option to switch between languages.<\/p>\n<p>As you can see the usage of ngx-translate is pretty straight forward. after having installed the package with the package manager of your choice (we used npm):<\/p>\n<pre class=\"editor editor-colors\"><span class=\"source shell\">npm\u00a0install\u00a0@ngx-translate\/core\u00a0--save<\/span><\/pre>\n<p>Then we import the core as TranslateService an use it in the appComponent. Now we add the desired languages in the constructor with the function <span class=\"theme:classic lang:js decode:true crayon-inline\">translate.addLangs([&#8216;en&#8217;, &#8216;fr&#8217;, &#8216;de&#8217;]);<\/span> . In our case it&#8217;s english, german and french. In the next step we set the default language to english: <span class=\"theme:classic lang:js decode:true crayon-inline\">translate.setDefaultLang(&#8216;en&#8217;);<\/span> .\u00a0 Regarding the configuration of the service, that&#8217;s already it. Now we define which language is used for starting the app &#8211; in our case we use the browser language.<\/p>\n<p>Therefore we use the function <span class=\"theme:classic lang:js decode:true crayon-inline\">translate.getBrowserLang();<\/span>\u00a0 to get the LOCALE_ID and store it in the constant <span class=\"theme:classic lang:js decode:true crayon-inline\">const browserLang<\/span> . To set a desired language we now can use the function <span class=\"theme:classic lang:js decode:true crayon-inline\">translate.use()<\/span>. Initially we want to determine if the <span class=\"theme:classic lang:js decode:true crayon-inline\">browserLang<\/span> is set to one of the choosable languages. If this is not the case, we initialize the component in english: <span class=\"theme:classic lang:js decode:true crayon-inline\">translate.use(browserLang.match(\/en|fr|de\/) ? browserLang : &#8216;en&#8217;);<\/span> . So now the TranslateService is configured and the initial language set. To use the functionality in the template, we add two more functions. <span class=\"theme:classic lang:js decode:true crayon-inline\">changeLanguage()changeLanguage(language: string)<\/span>\u00a0 which is called when switching the language dropdown and <span class=\"theme:classic lang:js decode:true crayon-inline\">get currentLanguage(): string<\/span>\u00a0 to query the currently selected language.<\/p>\n<pre class=\"lang:js decode:true\">import { Component } from '@angular\/core';\r\nimport {TranslateService} from '@ngx-translate\/core';\r\n\r\n@Component({\r\n  selector: 'app-root',\r\n  templateUrl: '.\/app.component.html',\r\n  styleUrls: ['.\/app.component.css']\r\n})\r\nexport class AppComponent {\r\n  title = 'ngx-translate without ProxyPipe';\r\n  today: Date = new Date();\r\n\r\n  constructor(public translate: TranslateService) {\r\n    translate.addLangs(['en', 'fr', 'de']);\r\n    translate.setDefaultLang('en');\r\n\r\n    const browserLang = translate.getBrowserLang();\r\n    translate.use(browserLang.match(\/en|fr|de\/) ? browserLang : 'en');\r\n  }\r\n\r\n  public changeLanguage(language: string){\r\n   this.translate.use(language)\r\n  }\r\n\r\n  public get currentLanguage(): string {\r\n   return this.translate.currentLang;\r\n  }\r\n}<\/pre>\n<p>Having set up the appCompontent.ts we now have a look on the template. We saved the different language strings in the three JSON-files en-json, de-json and fr-json. They all have the following structure:<\/p>\n<pre class=\"lang:js decode:true\" title=\"JSON language files\" data-url=\"assets\/i18n\/\">{\r\n  \"HOME\": {\r\n    \"TITLE\": \"...\",\r\n    \"TRAINING\": \"...\",\r\n    \"SELECT\": \"...\"\r\n  }\r\n}<\/pre>\n<p>Looking at the headline h2 we can see, we just print <span class=\"theme:classic lang:js decode:true crayon-inline\">HOME.TITLE<\/span>\u00a0 and use the translate-pipe Angular delivers us. There&#8217;s no change in standard procedure.\u00a0 the same happens with the other strings. For the date <span class=\"theme:classic lang:js decode:true crayon-inline\">&lt;p&gt;{{ today | date: &#8220;full&#8221;}}&lt;\/p&gt;c<\/span>\u00a0 we use the Angular date-pipe.\u00a0 For switching the languages we incorporate a select statement, which triggers the mentioned <span class=\"theme:classic lang:js decode:true crayon-inline\">(change)=&#8221;changeLanguage(langSelect.value)&#8221;<\/span>\u00a0 function on change and sets the current selection.<\/p>\n<pre class=\"lang:js decode:true\" title=\"appComponent.html\">&lt;div&gt;\r\n  &lt;h2&gt;{{ 'HOME.TITLE' | translate }}&lt;\/h2&gt;\r\n  &lt;label&gt;\r\n    &lt;div &gt;\r\n      &lt;p style=\"display: inline\"&gt;{{ 'HOME.TRAINING' | translate  }}&lt;\/p&gt; &lt;p&gt;{{ today | date: \"full\"}}&lt;\/p&gt;\r\n    &lt;\/div&gt;\r\n    {{ 'HOME.SELECT' | translate }}\r\n    &lt;select #langSelect (change)=\"changeLanguage(langSelect.value)\"&gt;\r\n      &lt;option *ngFor=\"let lang of translate.getLangs()\" [value]=\"lang\" [selected]=\"lang === translate.currentLang\"&gt;{{ lang }}&lt;\/option&gt;\r\n    &lt;\/select&gt;\r\n  &lt;\/label&gt;\r\n&lt;\/div&gt;<\/pre>\n<p>Finally we need to import the Translate Module in the appModule. To load the different language JSON-files, we register a loader for the Translate Module. This way the JSON-files can be loaded with the HttpClient.<\/p>\n<pre class=\"lang:js decode:true\" title=\"app.module.ts\">import { BrowserModule } from '@angular\/platform-browser';\r\nimport { NgModule } from '@angular\/core';\r\n\r\nimport { registerLocaleData } from '@angular\/common';\r\nimport { AppComponent } from '.\/app.component';\r\nimport {TranslateLoader, TranslateModule} from '@ngx-translate\/core';\r\nimport {TranslateHttpLoader} from '@ngx-translate\/http-loader';\r\nimport {HttpClient, HttpClientModule} from '@angular\/common\/http';\r\nimport { DateProxyPipe } from '.\/date-proxy-pipe.pipe';\r\n\r\nexport function HttpLoaderFactory(httpClient: HttpClient) {\r\n  return new TranslateHttpLoader(httpClient);\r\n}\r\n\r\n@NgModule({\r\n  declarations: [\r\n    AppComponent\r\n  ],\r\n  imports: [\r\n    BrowserModule,\r\n    HttpClientModule,\r\n    TranslateModule.forRoot({\r\n      loader: {\r\n        provide: TranslateLoader,\r\n        useFactory: HttpLoaderFactory,\r\n        deps: [HttpClient]\r\n      }\r\n    })\r\n  ],\r\n  providers: [HttpClient],\r\n  bootstrap: [AppComponent]\r\n})\r\nexport class AppModule { }<\/pre>\n<p>Et Voila! We are all set up for a nice user experience for switching the languages we configured at run-time. Check it out and have an overview over the DEMO-app in the Stackblitz following project:<\/p>\n<p><iframe height=\"400\" style=\"width: 100%;\" src=\"https:\/\/stackblitz.com\/edit\/ng-translate-without-pipe?embed=1&amp;file=src\/app\/app.component.ts&amp;view=preview\" scrolling=\"no\"><\/iframe><\/p>\n<p>But wait! Everything works fine, despite the language and format conversion of the displayed date. Surprised? Well that&#8217;s the shortcoming of using ngx-translate. It doesn&#8217;t support the usage of Angular&#8217;s delivered pipes. Most prominent when it comes to language formatting is the date-pipe and therefore we focus on a solution for this problem . The logic is adaptable to every Angular pipe though.<\/p>\n<h3>Using ngx-translate with ProxyPipe<\/h3>\n<p>Luckily there is a lightweight workaround for our little inconvenience. We have to build a proxy pipe, that will be positioned on top of the Angular date-pipe and injects the selected language. As you can see in the following code-snippet we create DateProxyPipe with the name <span class=\"theme:classic lang:js decode:true crayon-inline \">date<\/span> . so this overrides the call of the Angular date-pipe. In this DateProxyPipe we create a new DatePipe in the transfom function that consumes the <span class=\"theme:classic lang:js decode:true crayon-inline \">translateService.currentLang<\/span>\u00a0 function. The transform function of the DateProxyPipe takes a string for the\u00a0 value of the date and one for the desired pattern. The strings are passed on to the transform function of the new ngPipe, which is returned.<\/p>\n<pre class=\"lang:js decode:true\">import { DatePipe } from '@angular\/common';\r\nimport { Pipe, PipeTransform } from '@angular\/core';\r\nimport { TranslateService } from '@ngx-translate\/core';\r\n@Pipe({\r\n  name: 'date'\r\n})\r\nexport class DateProxyPipe implements PipeTransform {\r\n\r\n  constructor(private translateService: TranslateService) {\r\n  console.log(this.translateService.currentLang)\r\n  }\r\n\r\n  public transform(value: any, pattern: string = 'mediumDate',currentLang: any): any {\r\n    const ngPipe = new DatePipe(currentLang);\r\n    return ngPipe.transform(value, pattern);\r\n  }\r\n}<\/pre>\n<p>Now we can give the ProxyDatePipe the current language that is registered in the TranslateService and the date format will be set accordingly. The following Stackblitz project we included the ProxyDatePipe. You can see how the behavior of the Angular date-pipe is back in action with just a little bit of extra work.<\/p>\n<p><iframe height=\"400\" style=\"width: 100%;\" src=\"https:\/\/stackblitz.com\/edit\/ng-translate-with-pipe?embed=1&amp;file=src\/app\/app.component.ts&amp;amp&amp;view=preview\" scrolling=\"no\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Angular delivers it&#8217;s own i18n (internationalizion) API. Although the implementation is already very extensive and mature, some use cases are not covered. This also includes changing the language at run-time. When implementing Angular, a build must exist for each language. To close this gap, packages have been created that extend the functionality. A representative of [&#8230;]<br \/><a class=\"meta-big\" href=\"https:\/\/www.thecodecampus.de\/blog\/using-pipes-with-ngx-translate\/\"> READ MORE<\/a><\/p>\n","protected":false},"author":23,"featured_media":2232,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73,118,120,119,121,60],"tags":[112,126,124,127,123,122,125],"class_list":["post-2169","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-angular","category-datepipe","category-i18n","category-localeid","category-ngx-translate","category-typescript","tag-angular","tag-dynamic-date-pipe","tag-i18n","tag-locale_id","tag-localeid","tag-ngx-translate","tag-pipes"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Using pipes with ngx-translate - Web Development Blog<\/title>\n<meta name=\"description\" content=\"Angular covers broad and complex scenarios, but ngx-translate fills gaps, especially excelling in changing an app&#039;s language at runtime.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.thecodecampus.de\/blog\/using-pipes-with-ngx-translate\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using pipes with ngx-translate - Web Development Blog\" \/>\n<meta property=\"og:description\" content=\"Angular covers broad and complex scenarios, but ngx-translate fills gaps, especially excelling in changing an app&#039;s language at runtime.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.thecodecampus.de\/blog\/using-pipes-with-ngx-translate\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Development tips and tricks - theCodeCampus Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-01-07T12:09:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-22T08:23:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2020\/01\/languages.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1058\" \/>\n\t<meta property=\"og:image:height\" content=\"595\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Janik Kessler\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Janik Kessler\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/using-pipes-with-ngx-translate\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/using-pipes-with-ngx-translate\\\/\"},\"author\":{\"name\":\"Janik Kessler\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#\\\/schema\\\/person\\\/0dda62aeb98f2e9a89c2438b6f990101\"},\"headline\":\"Using pipes with ngx-translate\",\"datePublished\":\"2020-01-07T12:09:57+00:00\",\"dateModified\":\"2025-04-22T08:23:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/using-pipes-with-ngx-translate\\\/\"},\"wordCount\":1241,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/using-pipes-with-ngx-translate\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/languages.png\",\"keywords\":[\"Angular\",\"Dynamic Date Pipe\",\"i18n\",\"LOCALE_ID\",\"LocaleId\",\"ngx-translate\",\"Pipes\"],\"articleSection\":[\"Angular\",\"DatePipe\",\"i18n\",\"LocaleId\",\"ngx-translate\",\"TypeScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/using-pipes-with-ngx-translate\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/using-pipes-with-ngx-translate\\\/\",\"url\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/using-pipes-with-ngx-translate\\\/\",\"name\":\"Using pipes with ngx-translate - Web Development Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/using-pipes-with-ngx-translate\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/using-pipes-with-ngx-translate\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/languages.png\",\"datePublished\":\"2020-01-07T12:09:57+00:00\",\"dateModified\":\"2025-04-22T08:23:54+00:00\",\"description\":\"Angular covers broad and complex scenarios, but ngx-translate fills gaps, especially excelling in changing an app's language at runtime.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/using-pipes-with-ngx-translate\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/using-pipes-with-ngx-translate\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/using-pipes-with-ngx-translate\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/languages.png\",\"contentUrl\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/languages.png\",\"width\":1058,\"height\":595},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/using-pipes-with-ngx-translate\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using pipes with ngx-translate\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/\",\"name\":\"Web Development tips and tricks - theCodeCampus Blog\",\"description\":\"Tips, tricks, and experiences about developing web and mobile applications with Angular, TypeScript, and Testing.\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#organization\",\"name\":\"theCodeCampus\",\"url\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/TCC-Logo-Bildmarke-quadratisch.jpg\",\"contentUrl\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/TCC-Logo-Bildmarke-quadratisch.jpg\",\"width\":156,\"height\":156,\"caption\":\"theCodeCampus\"},\"image\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#\\\/schema\\\/person\\\/0dda62aeb98f2e9a89c2438b6f990101\",\"name\":\"Janik Kessler\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/janik-kessler-tcc-author-96x96.png\",\"url\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/janik-kessler-tcc-author-96x96.png\",\"contentUrl\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/janik-kessler-tcc-author-96x96.png\",\"caption\":\"Janik Kessler\"},\"description\":\"Hi, I'm Janik. I'm a web development enthusiast and love to share my experiences. As a software trainer and engineer, I always seek to exchange ideas with other developers. I've been part of the theCodeCampus team since 2019 and have had the opportunity to meet many exciting engineers, learning a great deal from their experiences.\",\"sameAs\":[\"https:\\\/\\\/thecodecampus.de\\\/ueber-uns\\\/trainer\\\/janik-kessler\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/janik-kessler-615034233\\\/\"],\"url\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/author\\\/jhorst\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using pipes with ngx-translate - Web Development Blog","description":"Angular covers broad and complex scenarios, but ngx-translate fills gaps, especially excelling in changing an app's language at runtime.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.thecodecampus.de\/blog\/using-pipes-with-ngx-translate\/","og_locale":"en_US","og_type":"article","og_title":"Using pipes with ngx-translate - Web Development Blog","og_description":"Angular covers broad and complex scenarios, but ngx-translate fills gaps, especially excelling in changing an app's language at runtime.","og_url":"https:\/\/www.thecodecampus.de\/blog\/using-pipes-with-ngx-translate\/","og_site_name":"Web Development tips and tricks - theCodeCampus Blog","article_published_time":"2020-01-07T12:09:57+00:00","article_modified_time":"2025-04-22T08:23:54+00:00","og_image":[{"width":1058,"height":595,"url":"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2020\/01\/languages.png","type":"image\/png"}],"author":"Janik Kessler","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Janik Kessler","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.thecodecampus.de\/blog\/using-pipes-with-ngx-translate\/#article","isPartOf":{"@id":"https:\/\/www.thecodecampus.de\/blog\/using-pipes-with-ngx-translate\/"},"author":{"name":"Janik Kessler","@id":"https:\/\/www.thecodecampus.de\/blog\/#\/schema\/person\/0dda62aeb98f2e9a89c2438b6f990101"},"headline":"Using pipes with ngx-translate","datePublished":"2020-01-07T12:09:57+00:00","dateModified":"2025-04-22T08:23:54+00:00","mainEntityOfPage":{"@id":"https:\/\/www.thecodecampus.de\/blog\/using-pipes-with-ngx-translate\/"},"wordCount":1241,"commentCount":1,"publisher":{"@id":"https:\/\/www.thecodecampus.de\/blog\/#organization"},"image":{"@id":"https:\/\/www.thecodecampus.de\/blog\/using-pipes-with-ngx-translate\/#primaryimage"},"thumbnailUrl":"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2020\/01\/languages.png","keywords":["Angular","Dynamic Date Pipe","i18n","LOCALE_ID","LocaleId","ngx-translate","Pipes"],"articleSection":["Angular","DatePipe","i18n","LocaleId","ngx-translate","TypeScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.thecodecampus.de\/blog\/using-pipes-with-ngx-translate\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.thecodecampus.de\/blog\/using-pipes-with-ngx-translate\/","url":"https:\/\/www.thecodecampus.de\/blog\/using-pipes-with-ngx-translate\/","name":"Using pipes with ngx-translate - Web Development Blog","isPartOf":{"@id":"https:\/\/www.thecodecampus.de\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.thecodecampus.de\/blog\/using-pipes-with-ngx-translate\/#primaryimage"},"image":{"@id":"https:\/\/www.thecodecampus.de\/blog\/using-pipes-with-ngx-translate\/#primaryimage"},"thumbnailUrl":"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2020\/01\/languages.png","datePublished":"2020-01-07T12:09:57+00:00","dateModified":"2025-04-22T08:23:54+00:00","description":"Angular covers broad and complex scenarios, but ngx-translate fills gaps, especially excelling in changing an app's language at runtime.","breadcrumb":{"@id":"https:\/\/www.thecodecampus.de\/blog\/using-pipes-with-ngx-translate\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.thecodecampus.de\/blog\/using-pipes-with-ngx-translate\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.thecodecampus.de\/blog\/using-pipes-with-ngx-translate\/#primaryimage","url":"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2020\/01\/languages.png","contentUrl":"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2020\/01\/languages.png","width":1058,"height":595},{"@type":"BreadcrumbList","@id":"https:\/\/www.thecodecampus.de\/blog\/using-pipes-with-ngx-translate\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.thecodecampus.de\/blog\/"},{"@type":"ListItem","position":2,"name":"Using pipes with ngx-translate"}]},{"@type":"WebSite","@id":"https:\/\/www.thecodecampus.de\/blog\/#website","url":"https:\/\/www.thecodecampus.de\/blog\/","name":"Web Development tips and tricks - theCodeCampus Blog","description":"Tips, tricks, and experiences about developing web and mobile applications with Angular, TypeScript, and Testing.","publisher":{"@id":"https:\/\/www.thecodecampus.de\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.thecodecampus.de\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.thecodecampus.de\/blog\/#organization","name":"theCodeCampus","url":"https:\/\/www.thecodecampus.de\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.thecodecampus.de\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2024\/01\/TCC-Logo-Bildmarke-quadratisch.jpg","contentUrl":"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2024\/01\/TCC-Logo-Bildmarke-quadratisch.jpg","width":156,"height":156,"caption":"theCodeCampus"},"image":{"@id":"https:\/\/www.thecodecampus.de\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.thecodecampus.de\/blog\/#\/schema\/person\/0dda62aeb98f2e9a89c2438b6f990101","name":"Janik Kessler","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2024\/09\/janik-kessler-tcc-author-96x96.png","url":"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2024\/09\/janik-kessler-tcc-author-96x96.png","contentUrl":"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2024\/09\/janik-kessler-tcc-author-96x96.png","caption":"Janik Kessler"},"description":"Hi, I'm Janik. I'm a web development enthusiast and love to share my experiences. As a software trainer and engineer, I always seek to exchange ideas with other developers. I've been part of the theCodeCampus team since 2019 and have had the opportunity to meet many exciting engineers, learning a great deal from their experiences.","sameAs":["https:\/\/thecodecampus.de\/ueber-uns\/trainer\/janik-kessler","https:\/\/www.linkedin.com\/in\/janik-kessler-615034233\/"],"url":"https:\/\/www.thecodecampus.de\/blog\/author\/jhorst\/"}]}},"_links":{"self":[{"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/posts\/2169","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/users\/23"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/comments?post=2169"}],"version-history":[{"count":42,"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/posts\/2169\/revisions"}],"predecessor-version":[{"id":3427,"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/posts\/2169\/revisions\/3427"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/media\/2232"}],"wp:attachment":[{"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/media?parent=2169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/categories?post=2169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/tags?post=2169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}