diff --git a/src/index.ts b/src/index.ts index 9ee0e1fa421..67bc2f82fd3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,7 +20,4 @@ export * from './animations/animation'; export * from './transitions/page-transition'; export * from './transitions/transition'; -export * from './translation/translate'; -export * from './translation/translate_pipe'; - export * from './navigation/nav-controller-base'; diff --git a/src/module.ts b/src/module.ts index 58cfd08078d..9997b46c2a2 100644 --- a/src/module.ts +++ b/src/module.ts @@ -28,7 +28,6 @@ import { PopoverController } from './components/popover/popover'; import { QueryParams, setupQueryParams, UrlToken } from './platform/query-params'; import { TapClick, setupTapClick } from './components/tap-click/tap-click'; import { ToastController } from './components/toast/toast'; -import { Translate } from './translation/translate'; import { registerModeConfigs } from './config/mode-registry'; import { registerTransitions } from './transitions/transition-registry'; import { TransitionController } from './transitions/transition-controller'; @@ -180,7 +179,6 @@ export class IonicModule { PopoverController, TapClick, ToastController, - Translate, TransitionController, { provide: LocationStrategy, useFactory: provideLocationStrategy, deps: [ PlatformLocation, [ new Inject(APP_BASE_HREF), new Optional()], Config ] }, diff --git a/src/translation/translate.ts b/src/translation/translate.ts deleted file mode 100644 index 907afd94310..00000000000 --- a/src/translation/translate.ts +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @private - * Provide multi-language and i18n support in your app. Translate works by - * mapping full strings to language translated ones. That means that you don't - * need to provide strings for your default language, just new languages. - * - * Note: The Angular team will be building an - * [Localization/Internationalization](https://docs.google.com/document/d/1mwyOFsAD-bPoXTk3Hthq0CAcGXCUw-BtTJMR4nGTY-0/view#heading=h.ixg45w3363q) - * provider, so this Translation provider may not be further developed. - * - * @usage - * ```js - * Translate.translations({ - * 'de': { - * 'Welcome to MyApp': 'Willkommen auf' - * } - * }) - * - * Changing the default language: - * - * Translate.setLanguage('de'); - * ``` - * - * Usage in a template: - * - * ```js - * {{ 'Welcome to MyApp' | translate }} - * ``` - */ -export class Translate { - private _transMap: any = {}; - private _language: any = {}; - - translations(lang: any, map: any) { - this._transMap[lang] = map; - } - - setLanguage(lang: any) { - this._language = lang; - console.warn('Translate provider and TranslatePipe has been deprecated and will be removed in the next version. Please use NG2-Translate instead: http://ionicframework.com/docs/v2/resources/ng2-translate/'); - } - - getTranslations(lang: any) { - return this._transMap[lang]; - } - - translate(key: any, lang: any) { - // If the language isn't specified and we have no overridden one, return the string passed. - if (!lang && !this._language) { - return key; - } - - let setLanguage = lang || this._language; - - let map = this.getTranslations(setLanguage); - - if (!map) { - console.warn('I18N: No translation for key', key, 'using language', setLanguage); - return ''; - } - return this._getTranslation(map, key); - } - - _getTranslation(map: any, key: any) { - return map && map[key] || ''; - } -} diff --git a/src/translation/translate_pipe.ts b/src/translation/translate_pipe.ts deleted file mode 100644 index d59d395b479..00000000000 --- a/src/translation/translate_pipe.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Injectable, Pipe, PipeTransform } from '@angular/core'; - -import { Translate } from './translate'; - -/** - * @private - * The Translate pipe makes it easy to translate strings. - * - * @usage - * Translate using the current language or language set through Translate.setLanguage - * {{ 'Please enter your location' | translate }} - * - * Translate using a specific language - * {{ 'Please enter your location' | translate:"de" }} - */ -@Pipe({name: 'translate'}) -@Injectable() -export class TranslatePipe implements PipeTransform { - private translate: any = {}; - - constructor(translate: Translate) { - this.translate = translate; - } - transform(value: any, args: any) { - let lang: any; - if (args.length > 0) { - lang = args[0]; - } - return this.translate.translate(value, lang); - } - - supports(obj: any) { return true; } -}