You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`(context) => {})`) as their first argument. (Exclud `useTranslation`) return the [`Intl.Locale`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale)
243
-
244
-
### Translations
245
-
246
-
- `useTranslation(context)`: use translation function
247
-
248
-
### Headers
249
-
250
-
- `getHeaderLocale(context, options)`: get locale from `accept-language` header
251
-
- `getHeaderLocales(context, options)`: get some locales from `accept-language` header
252
-
253
-
### Cookies
254
-
255
-
- `getCookieLocale(context, options)`: get locale from cookie
256
-
- `setCookieLocale(context, options)`: set locale to cookie
257
-
258
-
### Misc
259
-
260
-
- `getPathLocale(context, options)`: get locale from path
261
-
- `getQueryLocale(context, options)`: get locale from query
262
-
263
-
## Helpers
264
-
265
-
- `detectLocaleFromAcceptLanguageHeader(context)`: detect locale from `accept-language` header
254
+
See the [API References](https://github.com/intlify/srvmid/blob/main/packages/hono/docs/index.md)
266
255
267
256
## 🙌 Contributing guidelines
268
257
269
-
If you are interested in contributing to `@intlify/hono`, I highly recommend checking out [the contributing guidelines](/CONTRIBUTING.md) here. You'll find all the relevant information such as [how to make a PR](/CONTRIBUTING.md#pull-request-guidelines), [how to setup development](/CONTRIBUTING.md#development-setup)) etc., there.
258
+
If you are interested in contributing to `@intlify/hono`, I highly recommend checking out [the contributing guidelines](https://github.com/intlify/srvmid/blob/main/CONTRIBUTING.md) here. You'll find all the relevant information such as [how to make a PR](https://github.com/intlify/srvmid/blob/main/CONTRIBUTING.md#pull-request-guidelines), [how to setup development](https://github.com/intlify/srvmid/blob/main/CONTRIBUTING.md#development-setup) etc., there.
|`options`|`Options`| An i18n options like vue-i18n [`createI18n`]([https://vue-i18n.intlify.dev/guide/#javascript](https://vue-i18n.intlify.dev/guide/#javascript)), which are passed to `createCoreContext` of `@intlify/core`, see about details [`CoreOptions` of `@intlify/core`](https://github.com/intlify/vue-i18n-next/blob/6a9947dd3e0fe90de7be9c87ea876b8779998de5/packages/core-base/src/context.ts#L196-L216)|
29
+
30
+
## Returns
31
+
32
+
`MiddlewareHandler`
33
+
34
+
A defined i18n middleware
35
+
36
+
## Description
37
+
38
+
Define the middleware to be specified for Hono [`app.use`]([https://hono.dev/guides/middleware](https://hono.dev/guides/middleware))
function getHeaderLanguage(context, __namedParameters?):string;
11
+
```
12
+
13
+
get language from header
14
+
15
+
## Parameters
16
+
17
+
| Parameter | Type | Description |
18
+
| ------ | ------ | ------ |
19
+
|`context`|`Context`| A Context \| Hono context |
20
+
|`__namedParameters?`|`HeaderOptions`| - |
21
+
22
+
## Returns
23
+
24
+
`string`
25
+
26
+
A **first language tag** of header, if header is not exists, or `*` (any language), return empty string.
27
+
28
+
## Description
29
+
30
+
parse header string, default `accept-language`. if you use `accept-language`, this function retuns the **first language tag** of `accept-language` header.
0 commit comments