In order to enable language switching in my Angular application, I am looking to utilize the official Angular i18n library. This decision comes as a result of the previous go-to library (ngx-translate) being put into maintenance mode and scheduled for deprecation in the near future.
My main objective is to:
- Implement two buttons or icons on the user interface—one for toggling to English and another for switching to French.
- Ensure that when a user clicks one of these language-switching elements, the entire application adapts accordingly.
I aim to incorporate this functionality through the native features provided by Angular's i18n capabilities, rather than depending on external libraries like ngx-translate. Are there any recommended strategies or best practices for executing this feature? Could this be achieved without necessitating a rebuild?
Thus far, I have successfully established basic localization with Angular’s i18n framework by adhering to the official guidelines. I have applied i18n attributes to various template elements, created translation files, and conducted tests to validate language adjustments via rebuilding the application using different language setups (e.g., utilizing ng build --localize).
Despite making progress with this approach during the build phase, I am facing challenges when attempting to facilitate dynamic language alterations at runtime through user-triggered actions (such as clicking a button or icon) without requiring a full application reload.
I anticipated a more direct methodology within the Angular i18n library for updating languages based on user interactions.