robisim74 / angular-l10n

Angular library to translate texts, dates and numbers
MIT License
380 stars 59 forks source link

Removal of L10nLocation Interface and L10nRoutingModule #349

Closed 0nza1101 closed 3 months ago

0nza1101 commented 3 months ago

Hello @robisim74,

Our main application has been using your library since Angular v2, and we have consistently followed the significant updates to the library's API. However, we are now in a situation where we want to have our custom localized paths (e.g., fr/fr or fr/en), but with the L10nRoutingModule and the L10nLocation class removed, it seems more complicated.

Why were the L10nLocation interface and the L10nRoutingModule removed? Also, why are there now default non-localized routes enforced? Can custom localized paths still be achieved?

Thank you for your assistance.

Best regards,

robisim74 commented 3 months ago

Hi @0nza1101,

L10nRoutingModulehas been removed because many devs encountered several problems with its approach (url replacing).

The new suggested approach, without url replacing, but with manual url management, can be found here: https://github.com/robisim74/angular-l10n?tab=readme-ov-file#localized-routing and in the example app in this repo.

If in your case the old approach worked, and you want to continue using it without breaking changes, you can copy the classes into your project:

https://github.com/robisim74/angular-l10n/blob/angular_v15/projects/angular-l10n/src/lib/services/l10n-location.ts https://github.com/robisim74/angular-l10n/blob/angular_v15/projects/angular-l10n/src/lib/services/l10n-routing.service.ts https://github.com/robisim74/angular-l10n/blob/angular_v15/projects/angular-l10n/src/lib/modules/l10n-routing.module.ts https://github.com/robisim74/angular-l10n/blob/angular_v15/projects/angular-l10n/src/lib/services/l10n-loader.ts

In the same branch you can also find the types you need to complete the porting.

0nza1101 commented 3 months ago

I managed to get it working like before, the module is well decoupled from the rest, thanks for the suggestion.