Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelMarner committed Oct 9, 2017
1 parent dbe2ab6 commit 68e7450
Showing 1 changed file with 36 additions and 14 deletions.
50 changes: 36 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Mandatory Update for Ionic 2
# Mandatory Update for Ionic 2+

[![Build
Status](https://travis-ci.org/NextFaze/ionic-manup.svg?branch=master)](https://travis-ci.org/NextFaze/ionic-manup)
Expand Down Expand Up @@ -41,7 +41,7 @@ Mandatory Update (manup) works like this:
* `cordova-plugin-app-version`
* `@ionic-native/in-app-browser`
* `cordova-plugin-inappbrowser` to launch the link to the app/play store
* `@ngx-translate/core` Needed to handle translations (even if you don't use it in your app)


In your ionic project root:

Expand All @@ -53,6 +53,9 @@ ionic plugin add cordova-plugin-inappbrowser

Manup assumes you are using Semantic Versioning for your app.

### Optional
* `@ngx-translate/core` Needed to handle translations

## Installation

```sh
Expand Down Expand Up @@ -128,34 +131,53 @@ export class MyApp {

## Internationalisation Support

The service uses [ng2-translate](https://www.npmjs.com/package/ng2-translate) to support languages other than English. This package is the way [recommended](https://ionicframework.com/docs/v2/resources/ng2-translate/) by the Ionic developers.
The service uses [ngx-translate](https://www.npmjs.com/package/ng2-translate) to support languages other than English. This package is the way [recommended](https://ionicframework.com/docs/v2/resources/ng2-translate/) by the Ionic developers.

### With Built in translations

To make life easy for app developers, the service includes its own translation strings. All you need to do is add `ng2-translate` to your Ionic app and set the active language.
To make life easy for app developers, the service includes its own translation strings. All you need to do is add `ngx-translate` to your Ionic app and set the active language. Due to the way AOT works, you also need to provide a `TRANSLATE_SERVICE` for ManUp to use.

Languages supported are currently limited to English and a Google Translated Spanish. We would love pull requests for new languages.

#### Boostrap ng2-translate with your app!
#### Boostrap ngx-translate with your app!

```ts
import { ManUpModule } from 'ionic-manup';
import { TranslateModule } from 'ng2-translate';

// in your module's import array
TranslateModule.forRoot(),
ManUpModule.forRoot({url: 'https://example.com/manup.json'})
import { ManUpModule, ManUpService, TRANSLATE_SERVICE } from 'ionic-manup';
import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core';


@NgModule({
declarations: [MyApp, HomePage],
imports: [
...
ManUpModule.forRoot({
url: 'https://example.com/manup.json',
externalTranslations: true
}),
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: translateLoader,
deps: [HttpClient]
}
})
],
providers: [
{ provide: TRANSLATE_SERVICE, useClass: TranslateService },
ManUpService,
],
})
```

Note: This is an absolute bare minimum example of loading the module. Follow the instructions linked to above for how to use `ng2-translate` in your app.
Note: This is an absolute bare minimum example of loading the module. Follow the instructions linked to above for how to use `ngx-translate` in your app.

### With your own strings

If you want to further customise the messages, you can provide your own translations for the ManUp strings. _This is the only way we will be supporting customisation of the messages_.

#### Setup your language files

Follow the instructions for setting up `ng2-translate` with your Ionic 2 app, and add the following tree to your language files:
Follow the instructions for setting up `ngx-translate` with your Ionic 2 app, and add the following tree to your language files:


```json
Expand Down Expand Up @@ -196,7 +218,7 @@ You need to tell ManUp to use external translations. Modify your Bootstrap like

## Demonstration App

A demonstration app is in the `manup-demo` folder. This is the default Ionic 2 tabs starter app, with Manup added.
A demonstration app is in the `manup-demo` folder. This is the default Ionic 2 starter app, with ManUp added.

```sh
cd manup-demo
Expand Down

0 comments on commit 68e7450

Please sign in to comment.