Localization
The library now leverages Angular's built-in internationalization (i18n) system instead of a custom/third-party solution, providing better integration with Angular's ecosystem and improved consistency.The package now ships with default support for the following 11 languages out of the box: 'ar', 'bn', 'de', 'en', 'es', 'fr', 'hi', 'ja', 'pt', 'ru', 'zh'
These default translations can also be overridden with custom messages as needed.
- Inline message which will be the 1 priority.
- Add Mesage from config which will be the 2nd priroty.
- Default build in message which will be the 3rd prority.
#Inline message code snippet
<!DOCTYPE html>
<html lang="en">
...
<form (ngSubmit)="onSubmit(form)" #form="ngForm">
<input
type="text"
name="<name>"
[above]="<number>"
[message]="{en:'The :attribute should be above :arg0.',ar:'ال :attribute يجب أن يكون أعلاه :arg0.'}"
[(ngModel)]="<name>"
#<name>="ngModel">
</form>
...
</html>
#From config message code snippet
NgAbsoluteValidatorModule.forRoot({
translations: {
en:{above:'The :attribute should be above :arg0.'},
ar:{above:'ال :attribute يجب أن يكون أعلاه :arg0.'}
}
})