Skip to content

docs(02-faq.md): fakeLoader usage#8

Open
rbalet wants to merge 1 commit intoCodeAndWeb:mainfrom
rbalet:patch-2
Open

docs(02-faq.md): fakeLoader usage#8
rbalet wants to merge 1 commit intoCodeAndWeb:mainfrom
rbalet:patch-2

Conversation

@rbalet
Copy link
Contributor

@rbalet rbalet commented Aug 12, 2025

Tested it locally, () => new FakeLoader() is incorrect.

Note: a global fakeLoader need to be created in the project himself

const translations: TranslationObject = { TEST: 'This is a test' }
const fakeTranslation: TranslationObject = { NOT_USED: 'not used' }

@Injectable()
export class FakeLoader implements TranslateLoader {
  getTranslation(lang: string): Observable<TranslationObject> {
    if (lang === 'fake') {
      return of(fakeTranslation)
    }

    return of(translations)
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant