Commit: aae425b6 - "chore(transloco): 🤖 move to @jsverse/utils"
Many utility functions have been removed from @jsverse/transloco. some were moved to @jsverse/utils and some were internal only:
isFunction(),isString(),isNumber(),isObject(),isNil(),isDefined()size(),isEmpty()- Collection utilitiescoerceArray(),toCamelCase(),toNumber()- Conversion utilities
shouldListenToLangChanges(),listenOrNotOperator(),resolveInlineLoader()getEventPayload(),isScopeObject(),hasInlineLoader()getPipeValue(),getLangFromScope(),getScopeFromLang()flatten(),unflatten()
Commit: 6cd2f3e2 - "refactor(transloco): 💡 Remove all the schematics but init"
Removed schematics from @jsverse/transloco:
component(alias:c) - Component generationmigrate(alias:m) - Migration utilitiesscope(alias:s) - Scope generationupgrade(alias:up) - Upgrade utilitieskeys-manager(alias:km) - Keys managerjoin(alias:build) - Join translation filessplit(alias:sp) - Split translation filesng-migrate- Angular i18n migration
Only ng-add remains in the main package.
Migration: Install @jsverse/transloco-schematics for the moved schematics:
npm install @jsverse/transloco-schematics --save-dev
ng generate @jsverse/transloco-schematics:scope my-scopeCommit: 73d21aa0 - "feat(locale): improve locale detection logic in locale service (#862)"
File: libs/transloco-locale/src/lib/transloco-locale.service.ts
The TranslocoLocaleService constructor now includes initialization logic that changes locale detection:
- Service now proactively detects locale in this order:
- Browser locale (via
getBrowserCultureLang()) - Active language from TranslocoService
- Default locale
- Browser locale (via
- Locale is set during service construction rather than lazily
Migration: If you were setting locale immediately after service injection, review your initialization logic.
Packages were moved to the jsverse scope, the versioning continues from the last version of the previous scope.
- The package is now published under the
@jsversescope. - The transpiler matching algorithm has changed, see this key referencing discussion.
- The transpiler
transpilemethod signature has changed to an object. setTranslationKeymethod signature has changed, thelangparameter was moved to the config.
- The package is now published under the
@jsversescope and aligned to the main package major version (v7). - Updated the transpile method usages.
- Minimum Transloco version is now
^7.0.0.
- The package is now published under the
@jsversescope and aligned to the main package major version (v7).
- The package is now published under the
@jsversescope and aligned to the main package major version (v7).
- The package is now published under the
@jsversescope and aligned to the main package major version (v7).
- The package is now published under the
@jsversescope and aligned to the main package major version (v7).
- The package is now published under the
@jsversescope and aligned to the main package major version (v7).
- The package is now published under the
@jsversescope and aligned to the main package major version (v7).
- The package is now published under the
@jsversescope and aligned to the main package major version (v7).
- The package is now published under the
@jsversescope and aligned to the main package major version (v7).
Versions 5.0.8-10 also contains the breaking change in V6 but accidentally weren't marked correctly.
- Update
flatpackage to v6 which is ESM
V5 was focused on a major infra upgrade to improve Transloco's maintainability also moving to new Angular features. please take a look at the following:
@angular/corepeer dependency is now>=v16TRANSLOCO_SCOPEis now always provided as multi.- Remove
PersistStoragetype. - Pipes, directives and components are now standalone.
- Removed
forRootfromTranslocoModule, useprovideTranslocoand other provider functions.
@angular/corepeer dependency is now>=v16- Pipes, directives and components are now standalone.
- Injection tokens are now prefixed with
TRANSLOCO_ - Removed
forRootfromTranslocoLocaleModule, useprovideTranslocoLocaleand other provider functions.
@angular/corepeer dependency is now>=v16- Removed
TranslocoMessageFormatModule, useprovideTranslocoMessageformat.
@angular/corepeer dependency is now>=v16- Removed
TranslocoPersistLangModule, useprovideTranslocoPersistLang.
@angular/corepeer dependency is now>=v16- Removed
TranslocoPersistTranslationsModule, useprovideTranslocoPersistTranslations.
@angular/corepeer dependency is now>=v16- Removed
TranslocoPreloadLangsModule, useprovideTranslocoPreloadLangs.
Other packages were bumped to keep alignment.
Transloco now requires @angular/core v13 and above:
@angular/corepeer dependency is now>=v13
@angular/corepeer dependency is now>=v13
@angular/corepeer dependency is now>=v13
@angular/corepeer dependency is now>=v13
@angular/corepeer dependency is now>=v13
@angular/corepeer dependency is now>=v13
Other packages were bumped to keep alignment.
V3 was focused on a major infra upgrade to improve Transloco's maintainability and the ability to create new features easily. We have removed deprecated code and upgraded dependencies, please take a look at the following:
@angular/corepeer dependency is now>=v12- Removed
scopeMappingproperty from theTranslocoConfig, define the alias on the scope provider instead. - Removed
provideTranslocoConfigfunction. - LoadedEvent - removed
langproperty. TranslocoTestingModuleremovedwithLangsmethod, useforRootinstead.
@angular/corepeer dependency is now>=v12TranslocoLocaleModuleremovedinitmethod, useforRootinstead.
@angular/corepeer dependency is now>=v12- Upgraded
messageformatfrom v2.3.0 to@messageformat/corev3.0.0, see changelog for more information. TranslocoMessageFormatModuleremovedinitmethod, useforRootinstead.
- Messageformat compiled messages are now cached by default see #358 & messageformat caching. Thank goes to k3nsei.
@angular/corepeer dependency is now>=v12TranslocoPersistLangModuleremovedinitmethod, useforRootinstead.
@angular/corepeer dependency is now>=v12TranslocoPersistTranslationsModuleremovedinitmethod, useforRootinstead.
@angular/corepeer dependency is now>=v12TranslocoPreloadLangsModuleremovedpreloadmethod, useforRootinstead.
- Structural directive is now a memoized function:
// before {{ t.a.b }} {{ t.hello }} {{ t.someKey | translocoParams: { value: 'value' } }}After:
{{ t('a.b') }} {{ t('hello') }} {{ t('someKey', { value: 'value' }) }}- Dedicated method for when you need to query an object instead of a key:
// Before
service.translate('a.b', params);
service.selectTranslate('a.b', params);
// After
service.translateObject('a.b', params);
service.selectTranslateObject('a.b', params);MissingHandlerinterface: removes the second redundantparamsparam. (only relevant if you implemented a custom handler)
We also made minor changes in TranslocoConfig:
- It's now required to set the available languages in your application:
- We have changed the
listenToLangChangeflag to a more clearreRenderOnLangChange:
{
provide: TRANSLOCO_CONFIG,
useValue: {
availableLangs: ['en', 'es'],
reRenderOnLangChange: true
}
}We also allow passing an object making it easier for you to use it in a languages dropdown:
[{ id: 'en', label: 'English'}]
We need this information to know whether we're dealing with a language or a scope.
- Change
config.listenToLangChangetoconfig.reRenderOnLangChangeto make it more clear. - Remove callback param support from
translate(). - Remove messageformat from the library in favor of the external library.
We created a schematics command that'll do most of the work for you
- Each translation file is now flatten in runtime. This change brings benefits such as lower memory consumption, and faster value accessor.
- Missing handler support for the structural directive.
- Transloco optimizes library which will minify the translation files, flatten AOT, and removes comments.
- Support a fallback language for missing translation value or key.
- Set a scope alias directly in
TRANSLOCO_SCOPE.
A Transloco CLI tool that builds the translation files based on your code in development. Inform you about missing keys and extras. Stay tuned.