question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how-to use ngx-formly with ngx-translate

See original GitHub issue

[x ] support request

just a question:

Is there a way to use ngx-translate with formly? Any samples available?

Formly seems to be awesome but we can not find any working example for translation or the usage of pipes

something like

       ....
	{
		key: 'readyTime',
		type: 'select',		
		templateOptions: {
			description:  '"from" | translate' ,
			required: true,
			options: fromTime
		},
		...
	},
        ...

did not work (translate not defined)

Thanks for a hint!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:23 (14 by maintainers)

github_iconTop GitHub Comments

5reactions
aitboudadcommented, Jul 12, 2018

You can use one of the following methods:

  1. expressionProperties https://stackblitz.com/edit/ngx-formly-translate-1
  2. override the default wrappers for example label wrapper https://stackblitz.com/edit/ngx-formly-translate-2

for the first method it may introduce some performance issues for a large form which I’m thinking to solve it by allowing observable in expressionProperties, in the future you can use something like:

expressionProperties: {
  'templateOptions.label': this.translate.stream('HOME.SELECT'),
},
3reactions
aitboudadcommented, Jul 12, 2019

@johannesjo that requires adding ngx-translate as a dependency 😦, I see another approach that would make the integration much easy (using a custom extension), I’ll provide an example when time allows!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ngx Formly Ngx Translate - StackBlitz
Editor Preview Both. Sign in. Project. Search. Settings. Switch to Light Theme. Enter Zen Mode. Project. Download Project. Info. Ngx Formly Ngx Translate....
Read more >
Use Angular Formly Extensions to automatically localize all ...
[0:28] One way to translate is, for instance, to use NGX-Translate. I've actually already installed that to have to set up in place....
Read more >
[ngx-formly] Use Angular Formly Extensions to automatically ...
In this lesson we're diving a bit deeper and learn how to inject services into Formly Extensions with the example of using ngx-translate...
Read more >
How to use the @ngx-formly/core.FormlyModule.forRoot ...
import { TranslateService } from '@ngx-translate/core'; import { registerTranslateExtension } from './translate.extension'; // AoT requires an exported function ...
Read more >
i18n ngx-translate (alternative approach) - Formly
Formly · Examples · Advanced · i18n ngx-translate (alternative approach) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found