Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot + Angular 4 with i18n

I am currently developing an Angular 4 application with Spring Boot as backend. I use Maven to build the projects configured as explained in https://blog.jdriven.com/2016/12/angular2-spring-boot-getting-started/

I would now like to translate the application in other languages. I looked at http://www.baeldung.com/spring-boot-internationalization for the Spring Boot side, but now I'm wondering if it is possible to use my messages*.properties in Angular. Any experience with that?

Thanks,
Guillaume

like image 430
Guillaume Bailly Avatar asked Sep 28 '17 12:09

Guillaume Bailly


People also ask

What is spring boot i18n?

By SFG Contributor July 24, 2021 Spring, Spring Boot. 0 Comments. Internationalization or I18N is a process that makes your application adaptable to different languages and regions without engineering changes on the source code. You can display messages, currencies, date, time etc.

Can spring boot be used with angular?

Spring Boot and Angular form a powerful tandem that works great for developing web applications with a minimal footprint. In this tutorial, we'll use Spring Boot for implementing a RESTful backend, and Angular for creating a JavaScript-based frontend.

What is i18n in angular?

Angular Internationalizationlink Internationalization, sometimes referenced as i18n, is the process of designing and preparing your project for use in different locales around the world. Localization is the process of building versions of your project for different locales.


2 Answers

I think the best solution is make translation service in Angular. Java API will send messages or even keys and Angular will translate this on client side. You can prepare translation json files and use this library: https://github.com/ngx-translate/core

like image 121
Sebastian Straburzyński Avatar answered Oct 21 '22 19:10

Sebastian Straburzyński


You can check my Spring Boot 2 + Angular 6 starter. I am using ngx-translate.

like image 43
Milan Hlinák Avatar answered Oct 21 '22 17:10

Milan Hlinák