Formatting
Formating is a way how to render translation into a final string, with variable parameters. Formatters are supported in form of plugin.
Simple formatter
FormatSimple
plugin if you just need to include variables in your translations. It is very minimalistic, only intended to interpolate your parameters and save your bundle size.
import { FormatSimple } from '@tolgee/web';
...
tolgee.use(FormatSimple());
Icu formatter
For advanced formatting functionality install FormatIcu
plugin, which is shipped in separate package.
- npm
- yarn
- pnpm
npm install @tolgee/format-icu
yarn add @tolgee/format-icu
pnpm install @tolgee/format-icu
Use it like this:
import { FormatIcu } from '@tolgee/format-icu';
tolgee.use(FormatIcu());
Read more about ICU message format