Localizing labels and messages is not working
See original GitHub issueHi and thx for the library update =)
Here my code :
import { OwlDateTimeModule, OwlMomentDateTimeModule, OWL_DATE_TIME_FORMATS, OwlDateTimeIntl } from '@danielmoncada/angular-datetime-picker';
...
export class DefaultIntl extends OwlDateTimeIntl {
upSecondLabel = 'Add a second';
downSecondLabel = 'Minus a second';
upMinuteLabel = 'Add a minute';
downMinuteLabel = 'Minus a minute';
upHourLabel = 'Add a hour';
downHourLabel = 'Minus a hour';
prevMonthLabel = 'Previous month';
nextMonthLabel = 'Next month';
prevYearLabel = 'Previous year';
nextYearLabel = 'Next year';
prevMultiYearLabel = 'Previous 21 years';
nextMultiYearLabel = 'Next 21 years';
switchToMonthViewLabel = 'Change to month view';
switchToMultiYearViewLabel = 'Choose month and year';
cancelBtnLabel = 'Annuler';
setBtnLabel = 'Valider';
rangeFromLabel = 'From';
rangeToLabel = 'To';
hour12AMLabel = 'AM';
hour12PMLabel = 'PM';
}
...
providers: [
{ provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE] },
{ provide: LOCALE_ID, useValue: 'fr' },
{ provide: MAT_DATE_FORMATS, useValue: MY_FORMATS },
{ provide: MAT_DATE_LOCALE, useValue: 'fr-FR' },
{ provide: OWL_DATE_TIME_FORMATS, useValue: DATETIME_FORMATS },
{ provide: OwlDateTimeIntl, useClass: DefaultIntl }
]
I’ve customized setBtnLabel and cancelBtnLabel, but labels are not replaced and I still see “Cancel” and “Set”
I use @danielmoncada/angular-datetime-picker@9.4.2, @angular/core@~9.1.7 and build with Ivy.
I’ve tried in the demo stackblitz and this is working but those demo use an old version of the lib. I tried to make my own stackblitz with updated versions but it seems it doesn’t work with your lib : https://stackblitz.com/edit/angular-ivy-h2trhq?file=src%2Fapp%2Fapp.component.html
What should I do? Thx
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Localization labels & messages not working #405 - GitHub
Hi Daniel, I'm trying to use the localization & messages like in your example / docs here, but it doesn't seem to work:...
Read more >Localizing Labels and Error Messages
Labels and error messages are the static text that make up the Data Director user interface. The text cannot be localized through the...
Read more >Launchscreen ignoring my localizat… | Apple Developer Forums
It ignores completely my localization in Pt-Br. I have just a label on it with a loading message. I've tried both strings and...
Read more >Angular Owl Date Time Picker Labels and Buttons not localized
In your case the labels and messages seem to be not localized - try the approach in my answer below and adjust the...
Read more >Localization of AIP Client - cannot find --> Label: "not set"
I cannot find The phrase "not set", I scanned through the xml files without success, even policy exports did not show any sign...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I used this code to set language “es” and it worked, I hope it helps you
datetime-picker.config.ts
y en el app.module.ts lo importe de la siguiente manera
Hi,
I have the same issue, impossible to translate buttons “cancel” and “set”. I tried both solutions, this one of the documentation and the code posted by @Lempkin
What is the solution ?