Localization in Angular.js

When you are building a project that is going to have users from different part of the world it should be easy to be understood. There are github sources which you can use for translation- angular translate. If you want to use your own texts you have to use angular dependency injection. All you need to do is this. Create a new file and name it say myTexts_en_us. Then use $provide.value like given below.

$provide.value("myTexts", {firstText : "This is my localized text"});

For more real world use you can use a fiter:  http://jsfiddle.net/4tRBY/41/

Insert your new localization file into your html by JS or Seerver. You don’t have to set it up when you include the angular local files. Now add an id key to the $provide-value and set that value to the local language code in your file. This will be useful when testing.