In this version, we did a complete rewrite of core functionality, so the core has quite a different API. The goal was to make it more compact and move a lot of functionality into plugins, so we save bundle size and allow customization.
Packages are now organized, so you only need to install (and use) the most specific package. If you want to use Tolgee with vanilla JS, you should just install
@tolgee/core will be installed as a dependency). You can then import everything from
@tolge/web. Similarly, if you want integration for React, just install
@tolgee/react, and it installs and exports everything from
@tolgee/core, so you don't have to worry about these packages.
Rather than integrations doing Tolgee initialization for you, we now require you to do Tolgee initialization yourself. It requires a bit more work on your side, but now you have complete access to Tolgee instance, which allows more flexibility in the way how you use Tolgee (read more).
const tolgee = Tolgee()
// pass tolgee to integration
// or call tolgee.run() and use it without integration
Some of Tolgee functionality was moved to plugins, so it's now not included by default:
- ICU formatter - now shipped in separate package
@tolgee/format-icu, in examples we use
FormatSimple, which is simplified formatter with small bundle size included directly in core.
- In-context translating tools are now in a plugin called
DevTools(which is the same, only conditionally exported to only be included in dev mode)
- Fetching static json files -
- Language storage -
- Language detection -
fallbackLanguage was set to
en by default, but the language file was only fetched when some key was missing. We've now changed that to
fallbackLanguage being empty by default and if you set it, it will automatically fetch it right at the start, so it's immediately available (read more).
t now has the same interface in all integrations. It has some breaking changes.