# useTranslator

## Usage

Returns a translator function that resolves keys against the current locale, provider overrides, and the shipped English fallback catalog. Call inside a component; the returned function can be used anywhere within that component's scope.

```ts
import { useTranslator } from '@astryx-vue/core/locale'
```

The key is an upstream message key such as `@astryx.pagination.next`. Placeholder values are passed in order and formatted with the active locale's rules, so plural forms and number grouping follow that language. A key that has no slot in this package comes back unchanged, which makes a missing key visible instead of blank. `t` reads the provider on every call, so one translator keeps working after the provider switches language.

## Returns

| Name | Type | Description |
| --- | --- | --- |
| `t` | `(key: string, values?: Record<string, string \| number>) => string` | A translator function bound to the current InternationalizationProvider context. Call it with a message key and optional placeholder values to get the formatted string in the active locale. The function itself stays the same for the life of the component; every call reads the provider, so it is safe to use in render, event handlers, watchers, or any code that runs during the component's lifecycle. |
