Skip to content
Merged

V21 #23

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0ce7d04
added schema
oleg-wx Jul 31, 2026
1c87b92
update schema builder
oleg-wx Jul 31, 2026
e93a296
add params
oleg-wx Jul 31, 2026
a3b79c1
readme
oleg-wx Jul 31, 2026
1977d8a
added loader
oleg-wx Jul 31, 2026
5673b8f
add loader error handler
oleg-wx Aug 1, 2026
abe48dd
fix directive
oleg-wx Aug 1, 2026
92ec193
fix directive
oleg-wx Aug 1, 2026
7985050
readme loader
oleg-wx Aug 1, 2026
db010b0
added param validation
oleg-wx Aug 1, 2026
860960e
Merge branch 'master' of https://github.com/oleg-wx/translate-angular…
oleg-wx Aug 1, 2026
35f4067
Merge branch 'master' of https://github.com/oleg-wx/translate-angular…
oleg-wx Aug 1, 2026
a94c56e
fix the cache
oleg-wx Aug 1, 2026
4c3a708
changed the error accepting and added onready cb
oleg-wx Aug 4, 2026
77c0daf
add nullable params
oleg-wx Aug 4, 2026
e500e61
added decorator and more
oleg-wx Aug 5, 2026
02b3f40
Split TranslateProxy into its own package and prepare v1.0.0
oleg-wx Oct 9, 2026
7be2574
Merge origin/master (squashed #19, #20) into v17_and_fixes
oleg-wx Oct 9, 2026
ead3d70
Add standalone provideTranslate() API and migrate demo to standalone
oleg-wx Oct 19, 2026
a2b395a
move demo
oleg-wx Oct 19, 2026
50ad702
npmrc
oleg-wx Oct 19, 2026
03d96c7
Merge branch 'master' of https://github.com/oleg-wx/translate-angular…
oleg-wx Oct 19, 2026
5f694cf
upgraded to v19 + task
oleg-wx Oct 19, 2026
8ba537c
v20
oleg-wx Oct 19, 2026
0ea873d
v21
oleg-wx Oct 19, 2026
a0ba1ca
fix translate
oleg-wx Oct 19, 2026
df5bbd0
fix proxy
oleg-wx Oct 19, 2026
0a66047
fixes +
oleg-wx Oct 19, 2026
80a4ffd
fixes
oleg-wx Oct 19, 2026
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
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//registry.npmjs.org/:_authToken=${NPM_TOKEN?}
36 changes: 30 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,50 @@ Monorepo for [simply-translate](https://www.npmjs.com/package/simply-translate)

### [simply-translate-angular](projects/translate/README.md)

The core translation library — `TranslateModule`, directive, pipes, `TranslateService`, and dictionary loading (root/lazy). See [projects/translate/README.md](projects/translate/README.md) for setup and usage, and its [changelog](projects/translate/CHANGELOG.md).
The core translation library — `provideTranslate()`, standalone directive and pipes, `TranslateService`, and dictionary loading (root/lazy). See [projects/translate/README.md](projects/translate/README.md) for setup and usage, and its [changelog](projects/translate/CHANGELOG.md).

### [simply-translate-angular-proxy](projects/proxy/README.md)

Optional add-on built on top of `simply-translate-angular` — `TranslateProxy` for typed, autocompleted access to dictionary keys, schema-based dictionary validation, and per-proxy dictionary loading. See [projects/proxy/README.md](projects/proxy/README.md) for setup and usage, and its [changelog](projects/proxy/CHANGELOG.md).

## Versions

Both packages follow Angular's major version: 21.x is built for Angular 21 and later, 20.x for Angular 20, 19.x for Angular 19. For Angular 17–18 use 1.x.

21.0.0 removes the deprecated `TranslateModule` (`forRoot()` / `forChild()`); see [Migrating from TranslateModule](projects/translate/README.md#migrating-from-translatemodule).

## Development

Requires Node 20.19+, 22.12+ or 24 (the versions Angular 21 supports).

```bash
npm ci
npm test # tests both libraries once in headless Chrome
npm test # both libraries and the demo app, once in headless Chrome
npm run build:prod # builds dist/translate and dist/proxy
npm run start:demo # demo app on http://localhost:4800 (run build:prod first)
```

The proxy library and the demo app import `simply-translate-angular` from `dist/translate`, so build the translate library before working on them.
The libraries live in `projects/translate` and `projects/proxy`, the demo app in `projects/demo`. The proxy library imports `simply-translate-angular` from `dist/translate`, and the demo app imports both libraries from `dist`, so build them before working on the proxy or the demo — `npm test` does it in order.

## Releasing

1. Bump `version` in `projects/<translate|proxy>/package.json` and move the `(unreleased)` heading in that project's `CHANGELOG.md` to the new version.
2. Publish a GitHub Release whose tag is `<package name>@<version>`, for example `simply-translate-angular@1.0.0` or `simply-translate-angular-proxy@1.0.0`.
1. Bump `version` in `projects/<translate|proxy>/package.json` and move the `(unreleased)` heading in that project's `CHANGELOG.md` to the new version. Keep the major version equal to the Angular version the release is built for.
2. Publish a GitHub Release whose tag is `<package name>@<version>`, for example `simply-translate-angular@21.0.0` or `simply-translate-angular-proxy@21.0.0`.

The [Publish workflow](.github/workflows/publish.yml) checks that the tag matches the package version, runs the tests, and publishes that package to npm using trusted publishing, so no token is needed. Versions with a pre-release suffix (`21.1.0-beta.1`) go to the `next` dist-tag.

### Publishing from your machine

Needs an npm access token with write access to the package, read from the `NPM_TOKEN` environment variable (see [.npmrc](.npmrc)). With [Task](https://taskfile.dev), put it in a `.env` file in the repository root, which git ignores:

```bash
# .env
NPM_TOKEN=npm_xxxxxxxx
```

```bash
task publish:translate
task publish:proxy
```

The [Publish workflow](.github/workflows/publish.yml) checks that the tag matches the package version, runs the tests, and publishes that package to npm. Versions with a pre-release suffix (`1.1.0-beta.1`) go to the `next` dist-tag.
Without Task, set `NPM_TOKEN` in the environment and run `npm run publish:translate` / `npm run publish:proxy`.
45 changes: 45 additions & 0 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
version: '3'

dotenv: ['.env']

tasks:
build:translate:
desc: Build simply-translate-angular + proxy
cmds:
- npm run build:translate

build:proxy:
desc: Build simply-translate-angular-proxy
cmds:
- npm run build:proxy

build:
desc: Build simply-translate-angular + proxy
cmds:
- task: build:translate
- task: build:proxy

publish:translate:
desc: Build, then publish simply-translate-angular to npm
preconditions:
- sh: '[ -n "$NPM_TOKEN" ]'
msg: 'NPM_TOKEN is not set: add it to .env or the environment'
cmds:
- npm run publish:translate

publish:proxy:
desc: Build, then publish simply-translate-angular-proxy to npm
preconditions:
- sh: '[ -n "$NPM_TOKEN" ]'
msg: 'NPM_TOKEN is not set: add it to .env or the environment'
cmds:
- npm run publish:proxy

publish:
desc: Build, then publish both simply-translate-angular and simply-translate-angular-proxy to npm
preconditions:
- sh: '[ -n "$NPM_TOKEN" ]'
msg: 'NPM_TOKEN is not set: add it to .env or the environment'
cmds:
- task: publish:translate
- task: publish:proxy
75 changes: 50 additions & 25 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"newProjectRoot": "projects",
"projects": {
"simply-translate": {
"root": "",
"sourceRoot": "src",
"root": "projects/demo",
"sourceRoot": "projects/demo/src",
"projectType": "application",
"prefix": "app",
"schematics": {
Expand All @@ -18,16 +18,16 @@
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/simply-translate",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"index": "projects/demo/src/index.html",
"main": "projects/demo/src/main.ts",
"polyfills": "projects/demo/src/polyfills.ts",
"tsConfig": "projects/demo/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
"projects/demo/src/favicon.ico",
"projects/demo/src/assets"
],
"styles": [
"src/styles.scss"
"projects/demo/src/styles.scss"
],
"scripts": [],
"vendorChunk": true,
Expand All @@ -41,8 +41,8 @@
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
"replace": "projects/demo/src/environments/environment.ts",
"with": "projects/demo/src/environments/environment.prod.ts"
}
],
"optimization": true,
Expand Down Expand Up @@ -87,26 +87,26 @@
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.cjs",
"main": "projects/demo/src/test.ts",
"polyfills": "projects/demo/src/polyfills.ts",
"tsConfig": "projects/demo/tsconfig.spec.json",
"karmaConfig": "projects/demo/karma.conf.cjs",
"styles": [
"src/styles.scss"
"projects/demo/src/styles.scss"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets"
"projects/demo/src/favicon.ico",
"projects/demo/src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
"projects/demo/tsconfig.app.json",
"projects/demo/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
Expand All @@ -116,14 +116,14 @@
}
},
"simply-translate-e2e": {
"root": "e2e/",
"root": "projects/demo/e2e",
"projectType": "application",
"prefix": "",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"protractorConfig": "projects/demo/e2e/protractor.conf.js",
"devServerTarget": "simply-translate:serve"
},
"configurations": {
Expand All @@ -135,7 +135,7 @@
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"tsConfig": "projects/demo/e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
Expand Down Expand Up @@ -165,8 +165,7 @@
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/translate/src/test.ts",
"tsConfig": "projects/translate/tsconfig.spec.json",
"karmaConfig": "projects/translate/karma.conf.cjs"
"tsConfig": "projects/translate/tsconfig.spec.json"
}
},
"lint": {
Expand Down Expand Up @@ -219,5 +218,31 @@
},
"cli": {
"analytics": false
},
"schematics": {
"@schematics/angular:component": {
"type": "component"
},
"@schematics/angular:directive": {
"type": "directive"
},
"@schematics/angular:service": {
"type": "service"
},
"@schematics/angular:guard": {
"typeSeparator": "."
},
"@schematics/angular:interceptor": {
"typeSeparator": "."
},
"@schematics/angular:module": {
"typeSeparator": "."
},
"@schematics/angular:pipe": {
"typeSeparator": "."
},
"@schematics/angular:resolver": {
"typeSeparator": "."
}
}
}
Loading
Loading