Skip to content

Commit

Permalink
Moved from System to CommonJS
Browse files Browse the repository at this point in the history
  • Loading branch information
robisim74 committed May 28, 2016
1 parent 4cc44b9 commit cb04687
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 56 deletions.
6 changes: 5 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
/node_modules
/typings
/typings

# Dev
*.ts
!*.d.ts
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ You can add `angular2localization` to your project via [Node and npm](https://no
```
npm install --save angular2localization
```

### Loading via SystemJS
To load the package you have two methods using `SystemJS`:
- Loading the bundle:
```Html
```JavaScript
<script src="node_modules/angular2localization/bundles/angular2localization.js"></script>
```
- Using `System.config`:
```Html
- Using `SystemJS` configuration:
```JavaScript
<script>
System.config({
map: {
Expand All @@ -26,11 +28,21 @@ To load the package you have two methods using `SystemJS`:
},
packages: {
...
'angular2localization': { defaultExtension: 'js' }
'angular2localization': { format: 'cjs', defaultExtension: 'js' }
}
});
</script>
```
If you compile your app in `CommonJS`, remember to add your own app to the packages specifying the format:
```JavaScript
'app': { format: 'cjs', main: 'main.js', defaultExtension: 'js' }
```

### Loading via webpack
If you consume the library via `webpack`, simply import the library in your `vendor` file after Angular 2 imports:
```TypeScript
import 'angular2localization/angular2localization';
```

## Getting the translation
This library uses pure pipes. To know the advantages over impure pipes, please see [here](https://angular.io/docs/ts/latest/guide/pipes.html).
Expand Down Expand Up @@ -71,5 +83,7 @@ When specifying the `features`, you have to specify what locale, or locales to l
## Boilerplates
[Angular 2 Localization with an ASP.NET CORE MVC Service](https://damienbod.com/2016/04/29/angular-2-localization-with-an-asp-net-core-mvc-service/) @damienbod

## Contributing

##License
MIT
96 changes: 53 additions & 43 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,55 @@
{
"name": "angular2localization",
"version": "0.8.0",
"description": "An Angular 2 library to translate messages, dates and numbers",
"main": "",
"scripts": {},
"keywords": [
"Angular2",
"TypeScript",
"Internationalization",
"i18n",
"Localization",
"l10n",
"Translate",
"Validation"
],
"author": "Roberto Simonetti",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/robisim74/angular2localization.git"
},
"bugs": {
"url": "https://github.com/robisim74/angular2localization/issues"
},
"homepage": "https://github.com/robisim74/angular2localization",
"typings": "./angular2localization.d.ts",
"dependencies": {
"@angular/common": "2.0.0-rc.1",
"@angular/compiler": "2.0.0-rc.1",
"@angular/core": "2.0.0-rc.1",
"@angular/http": "2.0.0-rc.1",
"systemjs": "0.19.27",
"es6-shim": "^0.35.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12"
},
"devDependencies": {
"typescript": "^1.8.10",
"gulp": "^3.9.1",
"del": "^2.2.0",
"systemjs-builder": "^0.15.16"
}
"name": "angular2localization",
"version": "0.8.1",
"description": "An Angular 2 library to translate messages, dates and numbers",
"main": "angular2localization.js",
"scripts": {},
"typings": "./angular2localization.d.ts",
"keywords": [
"Angular2",
"TypeScript",
"Internationalization",
"i18n",
"Localization",
"l10n",
"Translate",
"Validation"
],
"author": "Roberto Simonetti",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/robisim74/angular2localization.git"
},
"bugs": {
"url": "https://github.com/robisim74/angular2localization/issues"
},
"homepage": "https://github.com/robisim74/angular2localization",
"peerDependencies": {
"@angular/common": "^2.0.0-rc.1",
"@angular/compiler": "^2.0.0-rc.1",
"@angular/core": "^2.0.0-rc.1",
"@angular/platform-browser": "^2.0.0-rc.1",
"@angular/platform-browser-dynamic": "^2.0.0-rc.1",
"@angular/http": "2.0.0-rc.1"
},
"devDependencies": {
"@angular/common": "^2.0.0-rc.1",
"@angular/compiler": "^2.0.0-rc.1",
"@angular/core": "^2.0.0-rc.1",
"@angular/platform-browser": "^2.0.0-rc.1",
"@angular/platform-browser-dynamic": "^2.0.0-rc.1",
"@angular/http": "2.0.0-rc.1",
"es6-promise": "^3.0.2",
"es6-shim": "^0.35.0",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.6",
"systemjs": "^0.19.26",
"typescript": "^1.8.10",
"typings": "^0.8.1",
"zone.js": "^0.6.12",
"gulp": "^3.9.1",
"del": "^2.2.0",
"systemjs-builder": "^0.15.18"
}
}
2 changes: 1 addition & 1 deletion src/services/locale-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {IntlSupport} from './Intl-support';
/**
* LocaleParser class.
*
* @author Roberto Simonetti 20/05/2016
* @author Roberto Simonetti
*/
export class LocaleParser {

Expand Down
14 changes: 7 additions & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
{
"compilerOptions": {
"noImplicitAny": true,
"module": "commonjs",
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"declaration": true
"inlineSourceMap": true,
"inlineSources": true,
"declaration": true,
"moduleResolution": "node"
},
"exclude": [
"node_modules"
Expand Down

0 comments on commit cb04687

Please sign in to comment.