Skip to content

Commit 10146fb

Browse files
authored
feat: support try APIs (#23)
1 parent 416286a commit 10146fb

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,16 +297,21 @@ The advantage of this way is that it is not necessary to specify the resource sc
297297
298298
- `getHeaderLocale(event, options)`: get locale from `accept-language` header
299299
- `getHeaderLocales(event, options)`: get some locales from `accept-language` header
300+
- `tryHeaderLocale(event, options)`: try to get locale from `accept-language` header
301+
- `tryHeaderLocales(event, options)`: try to get some locales from `accept-language` header
300302
301303
### Cookies
302304
303305
- `getCookieLocale(event, options)`: get locale from cookie
306+
- `tryCookieLocale(event, options)`: try to get locale from cookie
304307
- `setCookieLocale(event, options)`: set locale to cookie
305308
306309
### Misc
307310
308311
- `getPathLocale(event, options)`: get locale from path
312+
- `tryPathLocale(event, options)`: try to get locale from path
309313
- `getQueryLocale(event, options)`: get locale from query
314+
- `tryQueryLocale(event, options)`: try to get locale from query
310315
311316
## Helpers
312317

bun.lockb

0 Bytes
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,6 @@
8383
},
8484
"dependencies": {
8585
"@intlify/core": "^9.8.0",
86-
"@intlify/utils": "^0.11.1"
86+
"@intlify/utils": "^0.12.0"
8787
}
8888
}

src/index.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,7 @@
33
import { createCoreContext, NOT_REOSLVED, translate as _translate } from '@intlify/core'
44
import { getHeaderLocale } from '@intlify/utils/h3'
55

6-
export {
7-
getCookieLocale,
8-
getHeaderLanguage,
9-
getHeaderLanguages,
10-
getHeaderLocale,
11-
getHeaderLocales,
12-
getPathLocale,
13-
getQueryLocale,
14-
setCookieLocale,
15-
} from '@intlify/utils/h3'
6+
export * from '@intlify/utils/h3'
167

178
export type { CoreContext } from '@intlify/core'
189

0 commit comments

Comments
 (0)