How to use @ngx-translate/core - 10 common examples

To help you get started, we’ve selected a few @ngx-translate/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TwanoO67 / ngx-admin-lte / dist / services / translate.service.js View on Github external
useLang = prefLang.match(langmatch) ? prefLang : 'en';
            }
            _this.translate.use(useLang);
            console.log('Translation language has been set to: "' + useLang + '"');
            // translate.use( 'ru' );
        });
    }
    TranslateService.prototype.ngOnInit = function () {
        // TODO
    };
    TranslateService.prototype.getTranslate = function () {
        return this.translate;
    };
    TranslateService = __decorate([
        core_1.Injectable(),
        __metadata("design:paramtypes", [user_service_1.UserService, core_2.TranslateService])
    ], TranslateService);
    return TranslateService;
}());
exports.TranslateService = TranslateService;
github imolorhe / altair / src / app / components / doc-viewer / doc-viewer / doc-viewer.component.spec.ts View on Github external
beforeEach(async(() => {
    TestBed.configureTestingModule({
      imports: [
        TranslateModule.forRoot(),
        // Just import DocViewerModule since it contains all doc viewer component and dependencies
        DocViewerModule
      ],
      providers: [
        {
          provide: AltairConfig,
          useValue: new AltairConfig(),
        },
      ]
    })
    .compileComponents();
  }));
github moodlehq / moodlemobile2 / src / addon / block / blogrecent / blogrecent.module.ts View on Github external
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import { NgModule } from '@angular/core';
import { IonicModule } from 'ionic-angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreBlockDelegate } from '@core/block/providers/delegate';
import { AddonBlockBlogRecentHandler } from './providers/block-handler';

@NgModule({
    declarations: [
    ],
    imports: [
        IonicModule,
        TranslateModule.forChild()
    ],
    exports: [
    ],
    providers: [
        AddonBlockBlogRecentHandler
    ]
})
export class AddonBlockBlogRecentModule {
    constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockBlogRecentHandler) {
        blockDelegate.registerHandler(blockHandler);
    }
}
github IronPans / freeng / src / app / democase / common / language.ts View on Github external
]
})
export class SharedModule {

  constructor(private translate: TranslateService) {

    translate.addLangs(['en', 'zh-CN']);
    translate.setDefaultLang('zh-CN');

    // const browserLang = translate.getBrowserLang();
    // translate.use(browserLang.match(/en|zh-CN/) ? browserLang : 'en');
  }
}

@NgModule({
  imports: [CommonModule, TranslateModule.forChild({})],
  exports: [TranslateModule]
})
export class LanguageModule {}
github TwanoO67 / ngx-admin-lte / dist / ngx-admin-lte.module.js View on Github external
tasks_box_1.TasksBoxComponent,
                user_box_1.UserBoxComponent,
                component_loader_1.ComponentLoaderComponent,
                // LAYOUTS
                auth_1.LayoutAuthComponent,
                login_component_1.LayoutLoginComponent,
                register_component_1.LayoutRegisterComponent
            ],
            imports: [
                platform_browser_1.BrowserModule,
                forms_1.FormsModule,
                http_1.HttpModule,
                router_1.RouterModule,
                angular2_toaster_1.ToasterModule,
                http_2.HttpClientModule,
                core_2.TranslateModule.forRoot({
                    loader: {
                        provide: core_2.TranslateLoader,
                        useFactory: (HttpLoaderFactory),
                        deps: [http_2.HttpClient]
                    }
                }),
            ],
            exports: [
                safe_html_pipes_1.SafeHtmlPipe,
            ],
            providers: [
                // SERVICES
                user_service_1.UserService,
                menu_service_1.MenuService,
                logo_service_1.LogoService,
                footer_service_1.FooterService,
github TwanoO67 / ngx-admin-lte / dist / ngx-admin-lte.module.js View on Github external
component_loader_1.ComponentLoaderComponent,
                // LAYOUTS
                auth_1.LayoutAuthComponent,
                login_component_1.LayoutLoginComponent,
                register_component_1.LayoutRegisterComponent
            ],
            imports: [
                platform_browser_1.BrowserModule,
                forms_1.FormsModule,
                http_1.HttpModule,
                router_1.RouterModule,
                angular2_toaster_1.ToasterModule,
                http_2.HttpClientModule,
                core_2.TranslateModule.forRoot({
                    loader: {
                        provide: core_2.TranslateLoader,
                        useFactory: (HttpLoaderFactory),
                        deps: [http_2.HttpClient]
                    }
                }),
            ],
            exports: [
                safe_html_pipes_1.SafeHtmlPipe,
            ],
            providers: [
                // SERVICES
                user_service_1.UserService,
                menu_service_1.MenuService,
                logo_service_1.LogoService,
                footer_service_1.FooterService,
                breadcrumb_service_1.BreadcrumbService,
                messages_service_1.MessagesService,
github Alfresco / alfresco-ng2-components / lib / config / karma-test-shim.js View on Github external
require('zone.js/dist/async-test');
require('zone.js/dist/fake-async-test');

jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000;

var appContext = require.context(".", true, /.spec.ts/);appContext.keys().forEach(appContext);

const TestBed = require('@angular/core/testing').TestBed;
const browser = require('@angular/platform-browser-dynamic/testing');
const NoopAnimationsModule = require('@angular/platform-browser/animations').NoopAnimationsModule;
const CoreModule = require('@alfresco/adf-core').CoreModule;
const AppConfigService = require('@alfresco/adf-core').AppConfigService;
const AppConfigServiceMock = require('@alfresco/adf-core').AppConfigServiceMock;
const TranslationService = require('@alfresco/adf-core').TranslationService;
const TranslationMock = require('@alfresco/adf-core').TranslationMock;
const TranslateModule = require('@ngx-translate/core').TranslateModule;
const CommonModule = require('@angular/common').CommonModule;
const FormsModule = require('@angular/forms').FormsModule;
const ReactiveFormsModule = require('@angular/forms').ReactiveFormsModule;

TestBed.initTestEnvironment(browser.BrowserDynamicTestingModule, browser.platformBrowserDynamicTesting());

beforeEach(() => {
    TestBed.configureTestingModule({
        imports: [
            NoopAnimationsModule,
            CoreModule,
            TranslateModule,
            CommonModule,
            FormsModule,
            ReactiveFormsModule
        ],
github Alfresco / alfresco-ng2-components / lib / core / karma-test-shim.js View on Github external
require('zone.js/dist/jasmine-patch');
require('zone.js/dist/async-test');
require('zone.js/dist/fake-async-test');

jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;

var appContext = require.context(".", true, /.spec.ts/);appContext.keys().forEach(appContext);

const TestBed = require('@angular/core/testing').TestBed;
const browser = require('@angular/platform-browser-dynamic/testing');
const NoopAnimationsModule = require('@angular/platform-browser/animations').NoopAnimationsModule;
const FormsModule = require('@angular/forms').FormsModule;
const ReactiveFormsModule = require('@angular/forms').ReactiveFormsModule;
const HttpClient = require('@angular/common/http').HttpClient;
const HttpClientModule = require('@angular/common/http').HttpClientModule;
const TranslateModule = require('@ngx-translate/core').TranslateModule;
const TranslateLoader = require('@ngx-translate/core').TranslateLoader;

const DirectiveModule = require('./directives/directive.module').DirectiveModule;
const ContextMenuModule = require('./context-menu/context-menu.module').ContextMenuModule;
const PipeModule = require('./pipes/pipe.module').PipeModule;
const AppConfigModule = require('./app-config/app-config.module').AppConfigModule;
const LogService = require('./services/log.service').LogService;
const TranslateLoaderService = require('./services/translate-loader.service').TranslateLoaderService;

const AppConfigService = require('./app-config/app-config.service').AppConfigService;
const AppConfigServiceMock = require('./mock/app-config.service.mock').AppConfigServiceMock;

const AlfrescoApiServiceMock = require('./mock/alfresco-api.service.mock').AlfrescoApiServiceMock;
const AlfrescoApiService = require('./services/alfresco-api.service').AlfrescoApiService;
const providers = require('./core.module').providers;
github Alfresco / alfresco-ng2-components / lib / core / karma-test-shim.js View on Github external
require('zone.js/dist/async-test');
require('zone.js/dist/fake-async-test');

jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;

var appContext = require.context(".", true, /.spec.ts/);appContext.keys().forEach(appContext);

const TestBed = require('@angular/core/testing').TestBed;
const browser = require('@angular/platform-browser-dynamic/testing');
const NoopAnimationsModule = require('@angular/platform-browser/animations').NoopAnimationsModule;
const FormsModule = require('@angular/forms').FormsModule;
const ReactiveFormsModule = require('@angular/forms').ReactiveFormsModule;
const HttpClient = require('@angular/common/http').HttpClient;
const HttpClientModule = require('@angular/common/http').HttpClientModule;
const TranslateModule = require('@ngx-translate/core').TranslateModule;
const TranslateLoader = require('@ngx-translate/core').TranslateLoader;

const DirectiveModule = require('./directives/directive.module').DirectiveModule;
const ContextMenuModule = require('./context-menu/context-menu.module').ContextMenuModule;
const PipeModule = require('./pipes/pipe.module').PipeModule;
const AppConfigModule = require('./app-config/app-config.module').AppConfigModule;
const LogService = require('./services/log.service').LogService;
const TranslateLoaderService = require('./services/translate-loader.service').TranslateLoaderService;

const AppConfigService = require('./app-config/app-config.service').AppConfigService;
const AppConfigServiceMock = require('./mock/app-config.service.mock').AppConfigServiceMock;

const AlfrescoApiServiceMock = require('./mock/alfresco-api.service.mock').AlfrescoApiServiceMock;
const AlfrescoApiService = require('./services/alfresco-api.service').AlfrescoApiService;
const providers = require('./core.module').providers;

TestBed.initTestEnvironment(browser.BrowserDynamicTestingModule, browser.platformBrowserDynamicTesting());
github yduartep / angular-full-sample / src / app / core / header / header.component.spec.ts View on Github external
beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [HeaderComponent],
      schemas: [NO_ERRORS_SCHEMA],
      imports: [
        TranslateModule.forRoot({
          loader: {
            provide: TranslateLoader,
            useFactory: (createTranslateLoader),
            deps: [HttpClient]
          }
        }),
        SharedModule,
        RouterTestingModule.withRoutes([])
      ],
      providers: [
        {provide: 'LoggerService', useFactory: loggerFactory},
        {provide: 'api.config', useValue: apiConfig},
        {provide: 'AuthService', useClass: OAuthService},
        {provide: 'defaultLanguage', useValue: 'en'},
        SpinnerService,
        AuthHelper