Multilingual Support in ASP.NET Using AngularJS
In this post we will see how we can add a multilingual support in ASP.Net web applications when using AngularJS as a front end framework.
In Angular we can use angular-translate to provide localization support in web applications. They maintain a translation table in a json format and we can keep the name value pairs just like we used to do with resource files (.resx).
Below are the steps you can take to implement localization in SPA applications. I am assuming you will have the working Angular project ready in place and I will focus on the translation part only. If you want to start from the basics of setting AngularJS in ASP.NET application, you can go through the series of post I authored earlier on my blog i.e. http://ovaismehboob.wordpress.com and search angular
Following are the steps to configure translation in angular apps.
- We have to now use static file loader package to load our language files in json format. Static file loader script can be downloaded from https://cdnjs.com/libraries/angular-translate-loader-static-files.
- Make an entry in BundleConfig.cs file
- And finally, we can add resource files using useStaticFilesLoader method
- Hope this helps!
Credit: Source link