LogoLogo
โค๏ธ SponserMore
  • ๐Ÿš€Getting Started
    • Installation
    • Angular Compatibility
    • Config Options
  • ๐Ÿ’กCore Concepts
    • Translation in the Template
    • Signals
    • Translation API
    • Language API
  • ๐Ÿง Advanced Topics
    • ๐ŸฆฅLazy Load
      • Scope Configuration
      • Inline Loaders
    • The Transpiler
    • SSR Support
    • Unit Testing
    • Hack the Library
  • ๐ŸงชSandbox & Examples
  • โš™๏ธAdditional Functionality
    • Loading Template
    • Key Referencing
    • Utility Functions
    • Comments for Translators
    • Multiple Languages Simultaneously
  • ๐Ÿ“ฆMigration Guides
    • Migrate from ngx-translate
    • Migrate from Angular's i18n
  • ๐Ÿ”งTools
    • Keys Manager (TKM)
      • Keys Extractor
      • Keys Detective
      • Options
      • Debugging
      • Using with Nx ๐Ÿ‹
    • Validator
    • Optimize
    • Scoped Library Extractor
  • ๐Ÿ”ŒPlugins
    • Message Format
    • Persist Translations
    • Persist Lang
    • Preload Langs
    • Locale l10n
    • Community Plugins
  • ๐ŸงฐSchematics
    • :ng-add
    • :scope
    • :join
    • :split
  • ๐ŸณRecipies
    • Prefetch User Language
    • Using Xliff
    • Generate Locale Files using Google Translate
  • ๐Ÿ“šBlog Posts
    • Transloco Team Posts
      • Transloco Goes Functional: A Guide to Transloco's Functional Transpiler
    • From the Community
  • โ“FAQs
Powered by GitBook

@ 2025 Transloco

On this page
  • What will be done?โ€‹
  • Pipes
  • Directives
  • Imports
  • Constructor Injections
  • Service Usages
  • Manual Replacements
  • Modules

Was this helpful?

  1. Migration Guides

Migrate from ngx-translate

PreviousMigration GuidesNextMigrate from Angular's i18n

Last updated 5 months ago

Was this helpful?

What will be done?

The migration script will recursively iterate over your HTML and TypeScript files and perform the following replacements:

Pipes

Before

After

"hello.world" | translate

"hello.world" | transloco

"hello.world" | translate | anotherPipe | oneMore ...

"hello.world" | transloco | anotherPipe | oneMore ...

"hello" | translate:{name: 'Jhon'}

"hello" | transloco:{name: 'Jhon'}

Pipes used in bindings will also be replaced, for example: <component [header]="'hello.world' | translate"

Directives

Before

After

<div [translate]="'HELLO'" [translateParams]="{value: 'world'}"></div>

<div [transloco]="'HELLO'" [translocoParams]="{value: 'world'}"></div>

Imports

Before

After

import {TranslateService} from '@ngx-translate/core';

import { TranslocoService } from '@jsverse/transloco';

import {TranslateModule, TranslateLoader} from '@ngx-translate/core';

import {TranslateLoader} from '@ngx-translate/core'; import { TranslocoService } from '@jsverse/transloco';

Constructor Injections

Before

After

constructor(private translate: TranslateService) {

constructor(private translate: TranslocoService) {

Service Usages

Before

After

translateService.currentLang

translateService.getActiveLang()

translateService.onLangChange

translateService.langChanges$

translateService.use(...)

translateService.setActiveLang(...)

translateService.instant(...)

translateService.translate(...)

translateService.get(...)

translateService.selectTranslate(...).pipe(take(1))

translateService.stream(...)

translateService.selectTranslate(...)

translateService.set(...)

translateService.setTranslation(...)

Manual Replacements

Before

After

getBrowserLang()

In Transloco, this is a pure function that needs to be imported.

getBrowserCultureLang()

In Transloco, this is a pure function that needs to be imported.

currentLoader

No equivalent in Transloco.

addLangs(...)

No equivalent in Transloco.

getLangs(...)

No equivalent in Transloco.

reloadLang(...)

No equivalent in Transloco.

resetLang(...)

No equivalent in Transloco.

Modules

Before

After

TranslateModule.forChild({ loader: { provide: TranslateLoader, useFactory: HttpLoaderFactory, deps: [HttpClient] } })

TranslocoModule

๐Ÿ“ฆ
โ€‹