Decorators and i18n

Decorators are quite useful in Angular.
If you are not familiar with their usage, let’s say that they allow you to extend or overwrite a service (or directive or filter) in specific parts of your application without modifying the original one.

One of the advantages is that you don’t have to change too much of the implementation or your in-page code, but every part of your application will use the correct (decorated or original) version of every component.

If you need more information about decorators in Angular read the official documentation here

If you need more information about the decorator pattern in general you can find something here

i18n is the internationalization module provided by Angular: it is really useful for multi language applications as it offers an easy management not only for your labels, but calendar and currency as well.

Even if there is not a strict relation between Decorators and i18n, it’s quite possible that in multi language applications you need not only different translations, but custom rules depending on the language/country and in that situation the decorators come in handy.

Continue reading

Advertisements