Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrating changes from @codeandweb/ngx-translate #1494

Merged
merged 40 commits into from
Oct 31, 2024
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
2ee6026
Update README.md
CodeAndWeb Sep 5, 2024
e9dc562
#1444 fixed example
CodeAndWeb Sep 17, 2024
98fbf37
.gitignore
CodeAndWeb Sep 17, 2024
87798de
updated dependency in http-loader
CodeAndWeb Sep 5, 2024
0a19257
Readme updated for newer versions of Angular.
CodeAndWeb Sep 17, 2024
2ffd073
Merged master
CodeAndWeb Sep 17, 2024
50df6ee
Create ngx-translate-test.yml
CodeAndWeb Sep 17, 2024
18c2019
Fixed prebuild script to not fail if dist folder does not exist
CodeAndWeb Sep 17, 2024
cbe2e3b
Merge branch 'master' of github.com:CodeAndWeb/ngx-translate
CodeAndWeb Sep 17, 2024
eec6cbd
action
CodeAndWeb Sep 17, 2024
a82f81b
Build badge
CodeAndWeb Sep 17, 2024
eead4f5
Badge
CodeAndWeb Sep 17, 2024
a0cd5a5
Updated package version to 15
CodeAndWeb Sep 18, 2024
5174863
Updated project to Angular 18,
CodeAndWeb Sep 18, 2024
176eab1
Update ngx-translate-test.yml
CodeAndWeb Sep 18, 2024
4d1ab07
Merge commit '176eab14bfcde3ad19f6de5a2a5280ae854fe324'
CodeAndWeb Sep 18, 2024
f973151
Using explicit types instead of any. Moved getValue from translate.pa…
CodeAndWeb Sep 19, 2024
18221fc
Readme, licenses
CodeAndWeb Sep 23, 2024
1edb3ef
package.json
CodeAndWeb Sep 23, 2024
ccd17af
Made TranslatePipe and TranslateDirective standalone.
CodeAndWeb Sep 23, 2024
20cbdf5
https://github.com/ngx-translate/core/pull/1427
CodeAndWeb Sep 23, 2024
072722f
Added proviceTranslateService() for standalone modules
CodeAndWeb Sep 24, 2024
7acc672
Small demo project for experimenting.
CodeAndWeb Sep 24, 2024
c5c5798
Introducing provideTranslateService() instead of TranslateModule.forR…
CodeAndWeb Sep 24, 2024
e5f0ad9
Renamed InjectionToken USE_STORE to ISOLATE_TRANSLATE_SERVICE since t…
CodeAndWeb Sep 24, 2024
66a03dc
Version bump to beta.2
CodeAndWeb Sep 24, 2024
4511ded
Removed test-app from testing. It's for interactive experimenting whi…
CodeAndWeb Sep 24, 2024
e829d47
Added the extraction marker.
CodeAndWeb Sep 24, 2024
e5558ff
https://github.com/ngx-translate/core/pull/1411
CodeAndWeb Sep 25, 2024
f304f9b
Additional tests for recursive object translation.
CodeAndWeb Sep 25, 2024
0256722
https://github.com/ngx-translate/core/pull/1382/files
CodeAndWeb Sep 25, 2024
6aa94ed
Removed accidentally added console.logs
CodeAndWeb Sep 25, 2024
79cb220
Updated API Types in TranslateService
CodeAndWeb Sep 25, 2024
816b263
Made getTranslation deprecated
CodeAndWeb Sep 26, 2024
146140e
Always set currentLang to the language, use() was called last, not th…
CodeAndWeb Sep 26, 2024
17e5c68
Cleaned imports
CodeAndWeb Oct 1, 2024
32366f3
Fixed comment and exporting util functions
CodeAndWeb Oct 2, 2024
edb5ebc
Release 16.0.0
CodeAndWeb Oct 2, 2024
e1a883a
Using the newest angular version by default.
CodeAndWeb Oct 2, 2024
3d5b267
Update README.md
CodeAndWeb Oct 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added proviceTranslateService() for standalone modules
  • Loading branch information
CodeAndWeb committed Sep 24, 2024
commit 072722f57ae926525ff8adfc3251f24aaa3b70a0
19 changes: 18 additions & 1 deletion projects/ngx-translate/src/public-api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {NgModule, ModuleWithProviders, Provider} from "@angular/core";
import {NgModule, ModuleWithProviders, Provider, EnvironmentProviders, makeEnvironmentProviders} from "@angular/core";
import {TranslateLoader, TranslateFakeLoader} from "./lib/translate.loader";
import {MissingTranslationHandler, FakeMissingTranslationHandler} from "./lib/missing-translation-handler";
import {TranslateParser, TranslateDefaultParser} from "./lib/translate.parser";
Expand Down Expand Up @@ -30,6 +30,23 @@ export interface TranslateModuleConfig {
defaultLanguage?: string;
}

export const provideTranslateService = (config: TranslateModuleConfig = {}): EnvironmentProviders =>
{
return makeEnvironmentProviders([
config.loader || {provide: TranslateLoader, useClass: TranslateFakeLoader},
config.compiler || {provide: TranslateCompiler, useClass: TranslateFakeCompiler},
config.parser || {provide: TranslateParser, useClass: TranslateDefaultParser},
config.missingTranslationHandler || {provide: MissingTranslationHandler, useClass: FakeMissingTranslationHandler},
TranslateStore,
{provide: USE_STORE, useValue: config.isolate},
{provide: USE_DEFAULT_LANG, useValue: config.useDefaultLang},
{provide: USE_EXTEND, useValue: config.extend},
{provide: DEFAULT_LANGUAGE, useValue: config.defaultLanguage},
TranslateService
]);
}


@NgModule({
imports: [
TranslatePipe,
Expand Down