Skip to content

lymanlai/angularjs-i18n

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This module has been created by merging the work of 2 developers. See bottom of the page for credits.

This module has:

  • a service (localize)
  • a filter (i18n)
  • a directive (i18n).

Setup

<script src="localization.js"></script>
<script type="application/javascript">
	var myapp = angular.module('myapp', ['localization']);
</script>

Use it like this in your template (i18n is the filter)

{{'Hello World'|i18n}} 
{{"My name is %s and i am %d years old." | i18n:"Max":"98"}} 

Define your language JSON files in your approot/i18n/, named as the language you are targeting, ie

approot/i18n/en-US.json

The en-US.json file looks like this

{
    "Hello World" : "Hello World",
    "My name is %s and i am %d years old." : "My name is %s and i am %d years old."
}

The fr-FR.json file looks like this

{
    "Hello World" : "Bonjour Monde",
    "My name is %s and i am %d years old." : "Mon prenom est %s et j'ai %d ans."
}

Credits

About

AngularJS i18n module

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%