next-intl 2.22.0 → 2.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (362) hide show
  1. package/README.md +1 -1
  2. package/config.d.ts +3 -0
  3. package/dist/config.js +7 -0
  4. package/dist/development/_virtual/_rollupPluginBabelHelpers.js +20 -0
  5. package/dist/development/config.js +9 -0
  6. package/dist/development/index.js +21 -0
  7. package/dist/development/index.react-server.js +28 -0
  8. package/dist/development/middleware/getAlternateLinksHeaderValue.js +81 -0
  9. package/dist/development/middleware/middleware.js +146 -0
  10. package/dist/development/middleware/resolveLocale.js +110 -0
  11. package/dist/development/middleware/utils.js +150 -0
  12. package/dist/development/middleware.js +9 -0
  13. package/dist/development/navigation/BaseLink.js +52 -0
  14. package/dist/development/navigation/baseRedirect.js +22 -0
  15. package/dist/development/navigation/createLocalizedPathnamesNavigation.js +135 -0
  16. package/dist/development/navigation/createSharedPathnamesNavigation.js +19 -0
  17. package/dist/development/navigation/react-server/BaseLink.js +25 -0
  18. package/dist/development/navigation/react-server/baseRedirect.js +16 -0
  19. package/dist/development/navigation/react-server/createLocalizedPathnamesNavigation.js +77 -0
  20. package/dist/development/navigation/react-server/createSharedPathnamesNavigation.js +22 -0
  21. package/dist/development/navigation/useBasePathname.js +37 -0
  22. package/dist/development/navigation/useBaseRouter.js +76 -0
  23. package/dist/development/navigation/utils.js +108 -0
  24. package/dist/development/navigation.js +11 -0
  25. package/dist/development/navigation.react-server.js +11 -0
  26. package/dist/development/plugin.js +48 -0
  27. package/dist/development/react-client/index.js +38 -0
  28. package/dist/development/react-client/useLocale.js +24 -0
  29. package/dist/development/react-server/NextIntlClientProvider.js +33 -0
  30. package/dist/development/react-server/getBaseTranslator.js +21 -0
  31. package/dist/development/react-server/useFormatter.js +19 -0
  32. package/dist/development/react-server/useHook.js +21 -0
  33. package/dist/development/react-server/useLocale.js +14 -0
  34. package/dist/development/react-server/useMessages.js +19 -0
  35. package/dist/development/react-server/useNow.js +23 -0
  36. package/dist/development/react-server/useTimeZone.js +19 -0
  37. package/dist/development/react-server/useTranslations.js +19 -0
  38. package/dist/development/server/RequestLocale.js +43 -0
  39. package/dist/development/server/createRequestConfig.js +17 -0
  40. package/dist/development/server/getConfig.js +43 -0
  41. package/dist/development/server/getFormatter.js +26 -0
  42. package/dist/development/server/getLocale.js +11 -0
  43. package/dist/development/server/getMessages.js +21 -0
  44. package/dist/development/server/getNow.js +18 -0
  45. package/dist/development/server/getRequestConfig.js +12 -0
  46. package/dist/development/server/getTimeZone.js +18 -0
  47. package/dist/development/server/getTranslations.js +31 -0
  48. package/dist/development/server/resolveLocaleArg.js +15 -0
  49. package/dist/development/server.js +23 -0
  50. package/dist/development/shared/BaseLinkWithLocale.js +58 -0
  51. package/dist/development/shared/NextIntlClientProvider.js +30 -0
  52. package/dist/development/shared/constants.js +17 -0
  53. package/dist/development/shared/redirectWithLocale.js +16 -0
  54. package/dist/development/shared/utils.js +87 -0
  55. package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +1 -0
  56. package/dist/esm/config.js +1 -0
  57. package/dist/esm/index.js +1 -0
  58. package/dist/esm/index.react-server.js +1 -0
  59. package/dist/esm/middleware/getAlternateLinksHeaderValue.js +1 -0
  60. package/dist/esm/middleware/middleware.js +1 -0
  61. package/dist/esm/middleware/resolveLocale.js +1 -0
  62. package/dist/esm/middleware/utils.js +1 -0
  63. package/dist/esm/middleware.js +1 -0
  64. package/dist/esm/navigation/BaseLink.js +1 -0
  65. package/dist/esm/navigation/baseRedirect.js +1 -0
  66. package/dist/esm/navigation/createLocalizedPathnamesNavigation.js +1 -0
  67. package/dist/esm/navigation/createSharedPathnamesNavigation.js +1 -0
  68. package/dist/esm/navigation/react-server/BaseLink.js +1 -0
  69. package/dist/esm/navigation/react-server/baseRedirect.js +1 -0
  70. package/dist/esm/navigation/react-server/createLocalizedPathnamesNavigation.js +1 -0
  71. package/dist/esm/navigation/react-server/createSharedPathnamesNavigation.js +1 -0
  72. package/dist/esm/navigation/useBasePathname.js +2 -0
  73. package/dist/esm/navigation/useBaseRouter.js +1 -0
  74. package/dist/esm/navigation/utils.js +1 -0
  75. package/dist/esm/navigation.js +1 -0
  76. package/dist/esm/navigation.react-server.js +1 -0
  77. package/dist/esm/plugin.js +1 -0
  78. package/dist/esm/react-client/index.js +1 -0
  79. package/dist/esm/react-client/useLocale.js +1 -0
  80. package/dist/esm/react-server/NextIntlClientProvider.js +1 -0
  81. package/dist/esm/react-server/getBaseTranslator.js +1 -0
  82. package/dist/esm/react-server/useFormatter.js +1 -0
  83. package/dist/esm/react-server/useHook.js +1 -0
  84. package/dist/esm/react-server/useLocale.js +1 -0
  85. package/dist/esm/react-server/useMessages.js +1 -0
  86. package/dist/esm/react-server/useNow.js +1 -0
  87. package/dist/esm/react-server/useTimeZone.js +1 -0
  88. package/dist/esm/react-server/useTranslations.js +1 -0
  89. package/dist/esm/server/RequestLocale.js +1 -0
  90. package/dist/esm/server/createRequestConfig.js +1 -0
  91. package/dist/esm/server/getConfig.js +1 -0
  92. package/dist/esm/server/getFormatter.js +1 -0
  93. package/dist/esm/server/getLocale.js +1 -0
  94. package/dist/esm/server/getMessages.js +1 -0
  95. package/dist/esm/server/getNow.js +1 -0
  96. package/dist/esm/server/getRequestConfig.js +1 -0
  97. package/dist/esm/server/getTimeZone.js +1 -0
  98. package/dist/esm/server/getTranslations.js +1 -0
  99. package/dist/esm/server/resolveLocaleArg.js +1 -0
  100. package/dist/esm/server.js +1 -0
  101. package/dist/esm/shared/BaseLinkWithLocale.js +2 -0
  102. package/dist/esm/shared/NextIntlClientProvider.js +2 -0
  103. package/dist/esm/shared/constants.js +1 -0
  104. package/dist/esm/shared/redirectWithLocale.js +1 -0
  105. package/dist/esm/shared/utils.js +1 -0
  106. package/dist/index.js +3 -4
  107. package/dist/index.react-server.js +7 -0
  108. package/dist/middleware.js +7 -0
  109. package/dist/navigation.js +7 -0
  110. package/dist/navigation.react-server.js +7 -0
  111. package/dist/plugin.js +7 -0
  112. package/dist/production/_virtual/_rollupPluginBabelHelpers.js +1 -0
  113. package/dist/production/config.js +1 -0
  114. package/dist/production/index.js +1 -0
  115. package/dist/production/index.react-server.js +1 -0
  116. package/dist/production/middleware/getAlternateLinksHeaderValue.js +1 -0
  117. package/dist/production/middleware/middleware.js +1 -0
  118. package/dist/production/middleware/resolveLocale.js +1 -0
  119. package/dist/production/middleware/utils.js +1 -0
  120. package/dist/production/middleware.js +1 -0
  121. package/dist/production/navigation/BaseLink.js +1 -0
  122. package/dist/production/navigation/baseRedirect.js +1 -0
  123. package/dist/production/navigation/createLocalizedPathnamesNavigation.js +1 -0
  124. package/dist/production/navigation/createSharedPathnamesNavigation.js +1 -0
  125. package/dist/production/navigation/react-server/BaseLink.js +1 -0
  126. package/dist/production/navigation/react-server/baseRedirect.js +1 -0
  127. package/dist/production/navigation/react-server/createLocalizedPathnamesNavigation.js +1 -0
  128. package/dist/production/navigation/react-server/createSharedPathnamesNavigation.js +1 -0
  129. package/dist/production/navigation/useBasePathname.js +2 -0
  130. package/dist/production/navigation/useBaseRouter.js +1 -0
  131. package/dist/production/navigation/utils.js +1 -0
  132. package/dist/production/navigation.js +1 -0
  133. package/dist/production/navigation.react-server.js +1 -0
  134. package/dist/production/plugin.js +1 -0
  135. package/dist/production/react-client/index.js +1 -0
  136. package/dist/production/react-client/useLocale.js +1 -0
  137. package/dist/production/react-server/NextIntlClientProvider.js +1 -0
  138. package/dist/production/react-server/getBaseTranslator.js +1 -0
  139. package/dist/production/react-server/useFormatter.js +1 -0
  140. package/dist/production/react-server/useHook.js +1 -0
  141. package/dist/production/react-server/useLocale.js +1 -0
  142. package/dist/production/react-server/useMessages.js +1 -0
  143. package/dist/production/react-server/useNow.js +1 -0
  144. package/dist/production/react-server/useTimeZone.js +1 -0
  145. package/dist/production/react-server/useTranslations.js +1 -0
  146. package/dist/production/server/RequestLocale.js +1 -0
  147. package/dist/production/server/createRequestConfig.js +1 -0
  148. package/dist/production/server/getConfig.js +1 -0
  149. package/dist/production/server/getFormatter.js +1 -0
  150. package/dist/production/server/getLocale.js +1 -0
  151. package/dist/production/server/getMessages.js +1 -0
  152. package/dist/production/server/getNow.js +1 -0
  153. package/dist/production/server/getRequestConfig.js +1 -0
  154. package/dist/production/server/getTimeZone.js +1 -0
  155. package/dist/production/server/getTranslations.js +1 -0
  156. package/dist/production/server/resolveLocaleArg.js +1 -0
  157. package/dist/production/server.js +1 -0
  158. package/dist/production/shared/BaseLinkWithLocale.js +2 -0
  159. package/dist/production/shared/NextIntlClientProvider.js +2 -0
  160. package/dist/production/shared/constants.js +1 -0
  161. package/dist/production/shared/redirectWithLocale.js +1 -0
  162. package/dist/production/shared/utils.js +1 -0
  163. package/dist/server.js +7 -0
  164. package/dist/types/src/config.d.ts +1 -0
  165. package/dist/types/src/index.react-server.d.ts +1 -0
  166. package/dist/{src → types/src}/middleware/NextIntlMiddlewareConfig.d.ts +14 -10
  167. package/dist/types/src/middleware/getAlternateLinksHeaderValue.d.ts +12 -0
  168. package/dist/types/src/middleware/middleware.d.ts +4 -0
  169. package/dist/types/src/middleware/resolveLocale.d.ts +7 -0
  170. package/dist/types/src/middleware/utils.d.ts +17 -0
  171. package/dist/types/src/middleware.d.ts +1 -0
  172. package/dist/types/src/navigation/BaseLink.d.ts +63 -0
  173. package/dist/types/src/navigation/StrictParams.d.ts +8 -0
  174. package/dist/types/src/navigation/baseRedirect.d.ts +3 -0
  175. package/dist/types/src/navigation/createLocalizedPathnamesNavigation.d.ts +78 -0
  176. package/dist/types/src/navigation/createSharedPathnamesNavigation.d.ts +13 -0
  177. package/dist/types/src/navigation/index.d.ts +3 -0
  178. package/dist/types/src/navigation/react-server/BaseLink.d.ts +8 -0
  179. package/dist/types/src/navigation/react-server/baseRedirect.d.ts +3 -0
  180. package/dist/types/src/navigation/react-server/createLocalizedPathnamesNavigation.d.ts +60 -0
  181. package/dist/types/src/navigation/react-server/createSharedPathnamesNavigation.d.ts +44 -0
  182. package/dist/types/src/navigation/react-server/index.d.ts +3 -0
  183. package/dist/{src/client/usePathname.d.ts → types/src/navigation/useBasePathname.d.ts} +1 -1
  184. package/dist/{client/useRouter.d.ts → types/src/navigation/useBaseRouter.d.ts} +32 -31
  185. package/dist/types/src/navigation/utils.d.ts +51 -0
  186. package/dist/types/src/navigation.d.ts +1 -0
  187. package/dist/types/src/navigation.react-server.d.ts +1 -0
  188. package/dist/types/src/plugin.d.ts +1 -0
  189. package/dist/{react-client → types/src/react-client}/index.d.ts +15 -12
  190. package/dist/types/src/react-client/useLocale.d.ts +1 -0
  191. package/dist/types/src/react-server/NextIntlClientProvider.d.ts +5 -0
  192. package/dist/types/src/react-server/getBaseTranslator.d.ts +42 -0
  193. package/dist/types/src/react-server/index.d.ts +15 -0
  194. package/dist/types/src/react-server/useFormatter.d.ts +2 -0
  195. package/dist/types/src/react-server/useHook.d.ts +1 -0
  196. package/dist/types/src/react-server/useLocale.d.ts +2 -0
  197. package/dist/types/src/react-server/useMessages.d.ts +2 -0
  198. package/dist/types/src/react-server/useNow.d.ts +2 -0
  199. package/dist/types/src/react-server/useTimeZone.d.ts +2 -0
  200. package/dist/types/src/react-server/useTranslations.d.ts +2 -0
  201. package/dist/types/src/server/RequestLocale.d.ts +2 -0
  202. package/dist/types/src/server/createRequestConfig.d.ts +4 -0
  203. package/dist/types/src/server/getConfig.d.ts +23 -0
  204. package/dist/types/src/server/getFormatter.d.ts +14 -0
  205. package/dist/types/src/server/getLocale.d.ts +1 -0
  206. package/dist/types/src/server/getMessages.d.ts +3 -0
  207. package/dist/types/src/server/getNow.d.ts +3 -0
  208. package/dist/types/src/server/getRequestConfig.d.ts +10 -0
  209. package/dist/types/src/server/getTimeZone.d.ts +3 -0
  210. package/dist/types/src/server/getTranslations.d.ts +83 -0
  211. package/dist/types/src/server/index.d.ts +11 -0
  212. package/dist/types/src/server/resolveLocaleArg.d.ts +3 -0
  213. package/dist/types/src/server.d.ts +1 -0
  214. package/dist/types/src/shared/NextIntlClientProvider.d.ts +8 -0
  215. package/dist/{shared → types/src/shared}/constants.d.ts +3 -2
  216. package/dist/types/src/shared/redirectWithLocale.d.ts +3 -0
  217. package/dist/types/src/shared/types.d.ts +6 -0
  218. package/dist/{src → types/src}/shared/utils.d.ts +6 -0
  219. package/dist/types/test/middleware/getAlternateLinksHeaderValue.test.d.ts +1 -0
  220. package/dist/types/test/middleware/middleware.test.d.ts +1 -0
  221. package/dist/types/test/middleware/utils.test.d.ts +1 -0
  222. package/dist/types/test/navigation/BaseLink.test.d.ts +1 -0
  223. package/dist/types/test/navigation/createLocalizedPathnamesNavigation.test.d.ts +1 -0
  224. package/dist/types/test/navigation/createSharedPathnamesNavigation.test.d.ts +1 -0
  225. package/dist/types/test/navigation/useBasePathname.test.d.ts +1 -0
  226. package/dist/types/test/navigation/useBaseRouter.test.d.ts +1 -0
  227. package/dist/types/test/navigation/utils.test.d.ts +1 -0
  228. package/dist/types/test/react-client/useFormatter.test.d.ts +1 -0
  229. package/dist/types/test/react-client/useLocale.test.d.ts +1 -0
  230. package/dist/types/test/react-client/useNow.test.d.ts +1 -0
  231. package/dist/types/test/react-client/useTimeZone.test.d.ts +1 -0
  232. package/dist/types/test/react-client/useTranslations.test.d.ts +1 -0
  233. package/dist/types/test/server/index.test.d.ts +1 -0
  234. package/dist/types/test/setup.d.ts +1 -0
  235. package/dist/types/test/shared/NextIntlClientProvider.test.d.ts +1 -0
  236. package/dist/types/test/shared/utils.test.d.ts +1 -0
  237. package/middleware.d.ts +1 -1
  238. package/navigation.d.ts +1 -0
  239. package/package.json +45 -34
  240. package/plugin.d.ts +6 -0
  241. package/server.d.ts +1 -1
  242. package/client.d.ts +0 -1
  243. package/dist/_virtual/next-intl.esm.js +0 -29
  244. package/dist/_virtual/next-intl.esm.js.map +0 -1
  245. package/dist/client/NextIntlClientProvider.d.ts +0 -4
  246. package/dist/client/index.d.ts +0 -6
  247. package/dist/client/useClientLocale.d.ts +0 -1
  248. package/dist/client/usePathname.d.ts +0 -14
  249. package/dist/index.d.ts +0 -8
  250. package/dist/link/Link.d.ts +0 -27
  251. package/dist/link/index.d.ts +0 -1
  252. package/dist/link/react-server/Link.d.ts +0 -1
  253. package/dist/link/react-server/index.d.ts +0 -1
  254. package/dist/middleware/NextIntlMiddlewareConfig.d.ts +0 -28
  255. package/dist/middleware/getAlternateLinksHeaderValue.d.ts +0 -6
  256. package/dist/middleware/index.d.ts +0 -4
  257. package/dist/middleware/middleware.d.ts +0 -3
  258. package/dist/middleware/resolveLocale.d.ts +0 -6
  259. package/dist/middleware/utils.d.ts +0 -5
  260. package/dist/next-intl.cjs.development.js +0 -82
  261. package/dist/next-intl.cjs.development.js.map +0 -1
  262. package/dist/next-intl.cjs.production.min.js +0 -2
  263. package/dist/next-intl.cjs.production.min.js.map +0 -1
  264. package/dist/next-intl.esm.js +0 -3
  265. package/dist/next-intl.esm.js.map +0 -1
  266. package/dist/react-server/index.d.ts +0 -17
  267. package/dist/server/index.d.ts +0 -6
  268. package/dist/shared/BaseLink.d.ts +0 -7
  269. package/dist/shared/NextIntlClientProvider.d.ts +0 -9
  270. package/dist/shared/next-intl.esm.js +0 -41
  271. package/dist/shared/next-intl.esm.js.map +0 -1
  272. package/dist/shared/utils.d.ts +0 -15
  273. package/dist/src/client/NextIntlClientProvider.d.ts +0 -4
  274. package/dist/src/client/NextIntlClientProvider.js +0 -16
  275. package/dist/src/client/NextIntlClientProvider.js.map +0 -1
  276. package/dist/src/client/index.d.ts +0 -6
  277. package/dist/src/client/index.js +0 -8
  278. package/dist/src/client/index.js.map +0 -1
  279. package/dist/src/client/useClientLocale.d.ts +0 -1
  280. package/dist/src/client/useClientLocale.js +0 -18
  281. package/dist/src/client/useClientLocale.js.map +0 -1
  282. package/dist/src/client/usePathname.js +0 -34
  283. package/dist/src/client/usePathname.js.map +0 -1
  284. package/dist/src/client/useRouter.d.ts +0 -31
  285. package/dist/src/client/useRouter.js +0 -61
  286. package/dist/src/client/useRouter.js.map +0 -1
  287. package/dist/src/index.js +0 -9
  288. package/dist/src/index.js.map +0 -1
  289. package/dist/src/link/Link.d.ts +0 -27
  290. package/dist/src/link/Link.js +0 -29
  291. package/dist/src/link/Link.js.map +0 -1
  292. package/dist/src/link/index.d.ts +0 -1
  293. package/dist/src/link/index.js +0 -2
  294. package/dist/src/link/index.js.map +0 -1
  295. package/dist/src/link/react-server/Link.d.ts +0 -1
  296. package/dist/src/link/react-server/Link.js +0 -6
  297. package/dist/src/link/react-server/Link.js.map +0 -1
  298. package/dist/src/link/react-server/index.d.ts +0 -1
  299. package/dist/src/link/react-server/index.js +0 -2
  300. package/dist/src/link/react-server/index.js.map +0 -1
  301. package/dist/src/middleware/NextIntlMiddlewareConfig.js +0 -2
  302. package/dist/src/middleware/NextIntlMiddlewareConfig.js.map +0 -1
  303. package/dist/src/middleware/getAlternateLinksHeaderValue.d.ts +0 -6
  304. package/dist/src/middleware/getAlternateLinksHeaderValue.js +0 -71
  305. package/dist/src/middleware/getAlternateLinksHeaderValue.js.map +0 -1
  306. package/dist/src/middleware/index.js +0 -5
  307. package/dist/src/middleware/index.js.map +0 -1
  308. package/dist/src/middleware/middleware.d.ts +0 -3
  309. package/dist/src/middleware/middleware.js +0 -149
  310. package/dist/src/middleware/middleware.js.map +0 -1
  311. package/dist/src/middleware/resolveLocale.d.ts +0 -6
  312. package/dist/src/middleware/resolveLocale.js +0 -88
  313. package/dist/src/middleware/resolveLocale.js.map +0 -1
  314. package/dist/src/middleware/utils.d.ts +0 -5
  315. package/dist/src/middleware/utils.js +0 -37
  316. package/dist/src/middleware/utils.js.map +0 -1
  317. package/dist/src/react-client/index.d.ts +0 -12
  318. package/dist/src/react-client/index.js +0 -14
  319. package/dist/src/react-client/index.js.map +0 -1
  320. package/dist/src/react-server/index.d.ts +0 -17
  321. package/dist/src/react-server/index.js +0 -25
  322. package/dist/src/react-server/index.js.map +0 -1
  323. package/dist/src/server/index.d.ts +0 -6
  324. package/dist/src/server/index.js +0 -30
  325. package/dist/src/server/index.js.map +0 -1
  326. package/dist/src/shared/BaseLink.js +0 -38
  327. package/dist/src/shared/BaseLink.js.map +0 -1
  328. package/dist/src/shared/NextIntlClientProvider.d.ts +0 -9
  329. package/dist/src/shared/NextIntlClientProvider.js +0 -33
  330. package/dist/src/shared/NextIntlClientProvider.js.map +0 -1
  331. package/dist/src/shared/constants.d.ts +0 -2
  332. package/dist/src/shared/constants.js +0 -6
  333. package/dist/src/shared/constants.js.map +0 -1
  334. package/dist/src/shared/utils.js +0 -53
  335. package/dist/src/shared/utils.js.map +0 -1
  336. package/link.d.ts +0 -3
  337. package/src/client/NextIntlClientProvider.tsx +0 -18
  338. package/src/client/index.tsx +0 -9
  339. package/src/client/useClientLocale.tsx +0 -20
  340. package/src/client/usePathname.tsx +0 -40
  341. package/src/client/useRouter.tsx +0 -92
  342. package/src/index.tsx +0 -9
  343. package/src/link/Link.tsx +0 -34
  344. package/src/link/index.tsx +0 -1
  345. package/src/link/react-server/Link.tsx +0 -6
  346. package/src/link/react-server/index.tsx +0 -1
  347. package/src/middleware/NextIntlMiddlewareConfig.tsx +0 -42
  348. package/src/middleware/getAlternateLinksHeaderValue.tsx +0 -97
  349. package/src/middleware/index.tsx +0 -5
  350. package/src/middleware/middleware.tsx +0 -206
  351. package/src/middleware/resolveLocale.tsx +0 -151
  352. package/src/middleware/utils.tsx +0 -61
  353. package/src/react-client/index.tsx +0 -15
  354. package/src/react-server/index.tsx +0 -29
  355. package/src/server/index.tsx +0 -34
  356. package/src/shared/BaseLink.tsx +0 -57
  357. package/src/shared/NextIntlClientProvider.tsx +0 -54
  358. package/src/shared/constants.tsx +0 -6
  359. package/src/shared/utils.tsx +0 -91
  360. /package/dist/{src → types/src}/index.d.ts +0 -0
  361. /package/dist/{src → types/src}/middleware/index.d.ts +0 -0
  362. /package/dist/{src/shared/BaseLink.d.ts → types/src/shared/BaseLinkWithLocale.d.ts} +0 -0
@@ -1,27 +0,0 @@
1
- import React, { ComponentProps } from 'react';
2
- import BaseLink from '../shared/BaseLink';
3
- type Props = Omit<ComponentProps<typeof BaseLink>, 'locale'> & {
4
- locale?: string;
5
- };
6
- /**
7
- * Wraps `next/link` and prefixes the `href` with the current locale if
8
- * necessary.
9
- *
10
- * @example
11
- * ```tsx
12
- * import {Link} from 'next-intl';
13
- *
14
- * // When the user is on `/en`, the link will point to `/en/about`
15
- * <Link href="/about">About</Link>
16
- *
17
- * // You can override the `locale` to switch to another language
18
- * <Link href="/" locale="de">Switch to German</Link>
19
- * ```
20
- *
21
- * Note that when a `locale` prop is passed to switch the locale, the `prefetch`
22
- * prop is not supported. This is because Next.js would prefetch the page and
23
- * the `set-cookie` response header would cause the locale cookie on the current
24
- * page to be overwritten before the user even decides to change the locale.
25
- */
26
- declare const _default: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
27
- export default _default;
@@ -1 +0,0 @@
1
- export { default } from './Link';
@@ -1 +0,0 @@
1
- export { default } from '../Link';
@@ -1 +0,0 @@
1
- export { default } from './Link';
@@ -1,28 +0,0 @@
1
- type LocalePrefix = 'as-needed' | 'always' | 'never';
2
- type RoutingBaseConfig = {
3
- /** A list of all locales that are supported. */
4
- locales: Array<string>;
5
- defaultLocale: string;
6
- /** The default locale can be used without a prefix (e.g. `/about`). If you prefer to have a prefix for the default locale as well (e.g. `/en/about`), you can switch this option to `always`.
7
- */
8
- localePrefix?: LocalePrefix;
9
- };
10
- export type DomainConfig = Omit<RoutingBaseConfig, 'locales' | 'localePrefix'> & {
11
- /** The domain name (e.g. "example.com", "www.example.com" or "fr.example.com"). Note that the `x-forwarded-host` or alternatively the `host` header will be used to determine the requested domain. */
12
- domain: string;
13
- locales?: RoutingBaseConfig['locales'];
14
- };
15
- type MiddlewareConfig = RoutingBaseConfig & {
16
- /** Can be used to change the locale handling per domain. */
17
- domains?: Array<DomainConfig>;
18
- /** By setting this to `false`, the `accept-language` header will no longer be used for locale detection. */
19
- localeDetection?: boolean;
20
- /** Sets the `Link` response header to notify search engines about content in other languages (defaults to `true`). See https://developers.google.com/search/docs/specialty/international/localized-versions#http */
21
- alternateLinks?: boolean;
22
- };
23
- export type MiddlewareConfigWithDefaults = MiddlewareConfig & {
24
- alternateLinks: boolean;
25
- localePrefix: LocalePrefix;
26
- localeDetection: boolean;
27
- };
28
- export default MiddlewareConfig;
@@ -1,6 +0,0 @@
1
- import { NextRequest } from 'next/server';
2
- import { MiddlewareConfigWithDefaults } from './NextIntlMiddlewareConfig';
3
- /**
4
- * See https://developers.google.com/search/docs/specialty/international/localized-versions
5
- */
6
- export default function getAlternateLinksHeaderValue(config: MiddlewareConfigWithDefaults, request: NextRequest): string;
@@ -1,4 +0,0 @@
1
- /**
2
- * The middleware, available as `next-intl/middleware`.
3
- */
4
- export { default } from './middleware';
@@ -1,3 +0,0 @@
1
- import { NextRequest, NextResponse } from 'next/server';
2
- import MiddlewareConfig from './NextIntlMiddlewareConfig';
3
- export default function createMiddleware(config: MiddlewareConfig): (request: NextRequest) => NextResponse<unknown>;
@@ -1,6 +0,0 @@
1
- import { RequestCookies } from 'next/dist/server/web/spec-extension/cookies';
2
- import { DomainConfig, MiddlewareConfigWithDefaults } from './NextIntlMiddlewareConfig';
3
- export default function resolveLocale(config: MiddlewareConfigWithDefaults, requestHeaders: Headers, requestCookies: RequestCookies, pathname: string): {
4
- locale: string;
5
- domain?: DomainConfig;
6
- };
@@ -1,5 +0,0 @@
1
- import { DomainConfig } from './NextIntlMiddlewareConfig';
2
- export declare function getLocaleFromPathname(pathname: string): string;
3
- export declare function getHost(requestHeaders: Headers): string | undefined;
4
- export declare function isLocaleSupportedOnDomain(locale: string, domain: DomainConfig): boolean;
5
- export declare function getBestMatchingDomain(curHostDomain: DomainConfig | undefined, locale: string, domainConfigs: Array<DomainConfig>): DomainConfig | undefined;
@@ -1,82 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var useIntl = require('use-intl');
6
- var router = require('next/router');
7
- var React = require('react');
8
-
9
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
-
11
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
-
13
- function _extends() {
14
- _extends = Object.assign ? Object.assign.bind() : function (target) {
15
- for (var i = 1; i < arguments.length; i++) {
16
- var source = arguments[i];
17
- for (var key in source) {
18
- if (Object.prototype.hasOwnProperty.call(source, key)) {
19
- target[key] = source[key];
20
- }
21
- }
22
- }
23
- return target;
24
- };
25
- return _extends.apply(this, arguments);
26
- }
27
- function _objectWithoutPropertiesLoose(source, excluded) {
28
- if (source == null) return {};
29
- var target = {};
30
- var sourceKeys = Object.keys(source);
31
- var key, i;
32
- for (i = 0; i < sourceKeys.length; i++) {
33
- key = sourceKeys[i];
34
- if (excluded.indexOf(key) >= 0) continue;
35
- target[key] = source[key];
36
- }
37
- return target;
38
- }
39
-
40
- var _excluded = ["children", "locale", "now"];
41
- function NextIntlClientProvider(_ref) {
42
- var children = _ref.children,
43
- locale = _ref.locale,
44
- now = _ref.now,
45
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
46
- var router$1;
47
- try {
48
- // Reading from context is practically ok to do conditionally
49
- // eslint-disable-next-line react-hooks/rules-of-hooks
50
- router$1 = router.useRouter();
51
- } catch (error) {
52
- // Calling `useRouter` is not supported in the app folder
53
- }
54
- // The router can be undefined if used in a context outside
55
- // of Next.js (e.g. unit tests, Storybook, ...)
56
- if (!locale && router$1) {
57
- locale = router$1.locale;
58
- }
59
- // Currently RSC serialize dates to strings, therefore make sure we have
60
- // a date object. We might be able to remove this once more types have
61
- // first-class serialization support (https://github.com/facebook/react/issues/25687)
62
- if (typeof now === 'string') {
63
- now = new Date(now);
64
- }
65
- if (!locale) {
66
- throw new Error("Couldn't determine locale. Please pass an explicit `locale` prop the provider, or if you're using the `pages` folder, use internationalized routing (https://nextjs.org/docs/advanced-features/i18n-routing)." );
67
- }
68
- return React__default["default"].createElement(useIntl.IntlProvider, _extends({
69
- locale: locale,
70
- now: now
71
- }, rest), children);
72
- }
73
-
74
- exports.NextIntlClientProvider = NextIntlClientProvider;
75
- exports.NextIntlProvider = NextIntlClientProvider;
76
- Object.keys(useIntl).forEach(function (k) {
77
- if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
78
- enumerable: true,
79
- get: function () { return useIntl[k]; }
80
- });
81
- });
82
- //# sourceMappingURL=next-intl.cjs.development.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"next-intl.cjs.development.js","sources":["../src/shared/NextIntlClientProvider.tsx"],"sourcesContent":["'use client';\n\nimport {useRouter} from 'next/router';\nimport React, {ComponentProps} from 'react';\nimport {IntlProvider} from 'use-intl';\n\ntype Props = Omit<ComponentProps<typeof IntlProvider>, 'locale' | 'now'> & {\n locale?: string;\n /** If a string is supplied, make sure this conforms to the ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ */\n now?: Date | string;\n};\n\nexport default function NextIntlClientProvider({\n children,\n locale,\n now,\n ...rest\n}: Props) {\n let router;\n try {\n // Reading from context is practically ok to do conditionally\n // eslint-disable-next-line react-hooks/rules-of-hooks\n router = useRouter();\n } catch (error) {\n // Calling `useRouter` is not supported in the app folder\n }\n\n // The router can be undefined if used in a context outside\n // of Next.js (e.g. unit tests, Storybook, ...)\n if (!locale && router) {\n locale = router.locale;\n }\n\n // Currently RSC serialize dates to strings, therefore make sure we have\n // a date object. We might be able to remove this once more types have\n // first-class serialization support (https://github.com/facebook/react/issues/25687)\n if (typeof now === 'string') {\n now = new Date(now);\n }\n\n if (!locale) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? \"Couldn't determine locale. Please pass an explicit `locale` prop the provider, or if you're using the `pages` folder, use internationalized routing (https://nextjs.org/docs/advanced-features/i18n-routing).\"\n : undefined\n );\n }\n\n return (\n <IntlProvider locale={locale} now={now} {...rest}>\n {children}\n </IntlProvider>\n );\n}\n"],"names":["_excluded","NextIntlClientProvider","_ref","children","locale","now","rest","_objectWithoutPropertiesLoose","router","useRouter","error","Date","Error","React","createElement","IntlProvider","_extends"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAa,IAAAA,SAAA,GAAA,CAAA,UAAA,EAAA,QAAA,EAAA,KAAA,CAAA,CAAA;AAYW,SAAAC,sBAAsBA,CAAAC,IAAA,EAKtC;AAAA,EAAA,IAJNC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,GAAG,GAAAH,IAAA,CAAHG,GAAG;AACAC,IAAAA,IAAI,GAAAC,6BAAA,CAAAL,IAAA,EAAAF,SAAA,CAAA,CAAA;AAEP,EAAA,IAAIQ,QAAM,CAAA;EACV,IAAI;AACF;AACA;IACAA,QAAM,GAAGC,gBAAS,EAAE,CAAA;GACrB,CAAC,OAAOC,KAAK,EAAE;AACd;AAAA,GAAA;AAGF;AACA;AACA,EAAA,IAAI,CAACN,MAAM,IAAII,QAAM,EAAE;IACrBJ,MAAM,GAAGI,QAAM,CAACJ,MAAM,CAAA;AACvB,GAAA;AAED;AACA;AACA;AACA,EAAA,IAAI,OAAOC,GAAG,KAAK,QAAQ,EAAE;AAC3BA,IAAAA,GAAG,GAAG,IAAIM,IAAI,CAACN,GAAG,CAAC,CAAA;AACpB,GAAA;EAED,IAAI,CAACD,MAAM,EAAE;AACX,IAAA,MAAM,IAAIQ,KAAK,CAET,+MAA+M,CACtM,CACd,CAAA;AACF,GAAA;AAED,EAAA,OACEC,yBAAC,CAAAC,aAAA,CAAAC,oBAAY,EAAAC,QAAA,CAAA;AAACZ,IAAAA,MAAM,EAAEA,MAAM;AAAEC,IAAAA,GAAG,EAAEA,GAAAA;GAASC,EAAAA,IAAI,CAC7CH,EAAAA,QAAQ,CACI,CAAA;AAEnB;;;;;;;;;;;"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("use-intl"),r=require("next/router");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(require("react"));function o(){return o=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},o.apply(this,arguments)}var i=["children","locale","now"];function l(t){var l,u=t.children,a=t.locale,c=t.now,f=function(e,r){if(null==e)return{};var t,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r.indexOf(t=i[n])>=0||(o[t]=e[t]);return o}(t,i);try{l=r.useRouter()}catch(e){}if(!a&&l&&(a=l.locale),"string"==typeof c&&(c=new Date(c)),!a)throw new Error(void 0);return n.default.createElement(e.IntlProvider,o({locale:a,now:c},f),u)}exports.NextIntlClientProvider=l,exports.NextIntlProvider=l,Object.keys(e).forEach((function(r){"default"===r||exports.hasOwnProperty(r)||Object.defineProperty(exports,r,{enumerable:!0,get:function(){return e[r]}})}));
2
- //# sourceMappingURL=next-intl.cjs.production.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"next-intl.cjs.production.min.js","sources":["../src/shared/NextIntlClientProvider.tsx"],"sourcesContent":["'use client';\n\nimport {useRouter} from 'next/router';\nimport React, {ComponentProps} from 'react';\nimport {IntlProvider} from 'use-intl';\n\ntype Props = Omit<ComponentProps<typeof IntlProvider>, 'locale' | 'now'> & {\n locale?: string;\n /** If a string is supplied, make sure this conforms to the ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ */\n now?: Date | string;\n};\n\nexport default function NextIntlClientProvider({\n children,\n locale,\n now,\n ...rest\n}: Props) {\n let router;\n try {\n // Reading from context is practically ok to do conditionally\n // eslint-disable-next-line react-hooks/rules-of-hooks\n router = useRouter();\n } catch (error) {\n // Calling `useRouter` is not supported in the app folder\n }\n\n // The router can be undefined if used in a context outside\n // of Next.js (e.g. unit tests, Storybook, ...)\n if (!locale && router) {\n locale = router.locale;\n }\n\n // Currently RSC serialize dates to strings, therefore make sure we have\n // a date object. We might be able to remove this once more types have\n // first-class serialization support (https://github.com/facebook/react/issues/25687)\n if (typeof now === 'string') {\n now = new Date(now);\n }\n\n if (!locale) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? \"Couldn't determine locale. Please pass an explicit `locale` prop the provider, or if you're using the `pages` folder, use internationalized routing (https://nextjs.org/docs/advanced-features/i18n-routing).\"\n : undefined\n );\n }\n\n return (\n <IntlProvider locale={locale} now={now} {...rest}>\n {children}\n </IntlProvider>\n );\n}\n"],"names":["_excluded","NextIntlClientProvider","_ref","router","children","locale","now","rest","_objectWithoutPropertiesLoose","useRouter","error","Date","Error","undefined","React","createElement","IntlProvider","_extends"],"mappings":"6bAAa,IAAAA,EAAA,CAAA,WAAA,SAAA,OAYW,SAAAC,EAAsBC,GAKtC,IACFC,EALJC,EAAQF,EAARE,SACAC,EAAMH,EAANG,OACAC,EAAGJ,EAAHI,IACGC,oIAAIC,CAAAN,EAAAF,GAGP,IAGEG,EAASM,EAASA,WACnB,CAAC,MAAOC,GACP,CAgBF,IAXKL,GAAUF,IACbE,EAASF,EAAOE,QAMC,iBAARC,IACTA,EAAM,IAAIK,KAAKL,KAGZD,EACH,MAAM,IAAIO,WAGJC,GAIR,OACEC,UAACC,cAAAC,EAAYA,aAAAC,EAAA,CAACZ,OAAQA,EAAQC,IAAKA,GAASC,GACzCH,EAGP"}
@@ -1,3 +0,0 @@
1
- export * from 'use-intl';
2
- export { default as NextIntlClientProvider, default as NextIntlProvider } from './shared/next-intl.esm.js';
3
- //# sourceMappingURL=next-intl.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"next-intl.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,17 +0,0 @@
1
- /**
2
- * This is the main entry file when 'react-server' environments
3
- * (i.e. RSC) import from 'next-intl'. Currently we export everything
4
- * from `use-intl` core, but React-APIs are stubbed out.
5
- *
6
- * Make sure this mirrors the API from '../react-client'.
7
- */
8
- export * from 'use-intl/dist/src/core';
9
- export { default as NextIntlClientProvider } from '../shared/NextIntlClientProvider';
10
- declare function notSupported(): void;
11
- export declare const IntlProvider: typeof notSupported;
12
- export declare const useTranslations: typeof notSupported;
13
- export declare const useIntl: typeof notSupported;
14
- export declare const useLocale: typeof notSupported;
15
- export declare const useNow: typeof notSupported;
16
- export declare const useTimeZone: typeof notSupported;
17
- export declare const Link: typeof notSupported;
@@ -1,6 +0,0 @@
1
- /**
2
- * Server-only APIs available via `next-intl/server`.
3
- */
4
- import MiddlewareConfig from '../middleware/NextIntlMiddlewareConfig';
5
- /** @deprecated Should be imported as `import createMiddleware from 'next-intl/middleware', not from `next-intl/server`. */
6
- export declare function createIntlMiddleware(config: MiddlewareConfig): (request: import("next/server").NextRequest) => import("next/server").NextResponse<unknown>;
@@ -1,7 +0,0 @@
1
- import NextLink from 'next/link';
2
- import React, { ComponentProps } from 'react';
3
- type Props = Omit<ComponentProps<typeof NextLink>, 'locale'> & {
4
- locale: string;
5
- };
6
- declare const _default: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
7
- export default _default;
@@ -1,9 +0,0 @@
1
- import { ComponentProps } from 'react';
2
- import { IntlProvider } from 'use-intl';
3
- type Props = Omit<ComponentProps<typeof IntlProvider>, 'locale' | 'now'> & {
4
- locale?: string;
5
- /** If a string is supplied, make sure this conforms to the ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ */
6
- now?: Date | string;
7
- };
8
- export default function NextIntlClientProvider({ children, locale, now, ...rest }: Props): JSX.Element;
9
- export {};
@@ -1,41 +0,0 @@
1
- import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../_virtual/next-intl.esm.js';
2
- import { useRouter } from 'next/router';
3
- import React from 'react';
4
- import { IntlProvider } from 'use-intl';
5
-
6
- var _excluded = ["children", "locale", "now"];
7
- function NextIntlClientProvider(_ref) {
8
- var children = _ref.children,
9
- locale = _ref.locale,
10
- now = _ref.now,
11
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
12
- var router;
13
- try {
14
- // Reading from context is practically ok to do conditionally
15
- // eslint-disable-next-line react-hooks/rules-of-hooks
16
- router = useRouter();
17
- } catch (error) {
18
- // Calling `useRouter` is not supported in the app folder
19
- }
20
- // The router can be undefined if used in a context outside
21
- // of Next.js (e.g. unit tests, Storybook, ...)
22
- if (!locale && router) {
23
- locale = router.locale;
24
- }
25
- // Currently RSC serialize dates to strings, therefore make sure we have
26
- // a date object. We might be able to remove this once more types have
27
- // first-class serialization support (https://github.com/facebook/react/issues/25687)
28
- if (typeof now === 'string') {
29
- now = new Date(now);
30
- }
31
- if (!locale) {
32
- throw new Error(process.env.NODE_ENV !== 'production' ? "Couldn't determine locale. Please pass an explicit `locale` prop the provider, or if you're using the `pages` folder, use internationalized routing (https://nextjs.org/docs/advanced-features/i18n-routing)." : undefined);
33
- }
34
- return React.createElement(IntlProvider, _extends({
35
- locale: locale,
36
- now: now
37
- }, rest), children);
38
- }
39
-
40
- export { NextIntlClientProvider as default };
41
- //# sourceMappingURL=next-intl.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"next-intl.esm.js","sources":["../../src/shared/NextIntlClientProvider.tsx"],"sourcesContent":["'use client';\n\nimport {useRouter} from 'next/router';\nimport React, {ComponentProps} from 'react';\nimport {IntlProvider} from 'use-intl';\n\ntype Props = Omit<ComponentProps<typeof IntlProvider>, 'locale' | 'now'> & {\n locale?: string;\n /** If a string is supplied, make sure this conforms to the ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ */\n now?: Date | string;\n};\n\nexport default function NextIntlClientProvider({\n children,\n locale,\n now,\n ...rest\n}: Props) {\n let router;\n try {\n // Reading from context is practically ok to do conditionally\n // eslint-disable-next-line react-hooks/rules-of-hooks\n router = useRouter();\n } catch (error) {\n // Calling `useRouter` is not supported in the app folder\n }\n\n // The router can be undefined if used in a context outside\n // of Next.js (e.g. unit tests, Storybook, ...)\n if (!locale && router) {\n locale = router.locale;\n }\n\n // Currently RSC serialize dates to strings, therefore make sure we have\n // a date object. We might be able to remove this once more types have\n // first-class serialization support (https://github.com/facebook/react/issues/25687)\n if (typeof now === 'string') {\n now = new Date(now);\n }\n\n if (!locale) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? \"Couldn't determine locale. Please pass an explicit `locale` prop the provider, or if you're using the `pages` folder, use internationalized routing (https://nextjs.org/docs/advanced-features/i18n-routing).\"\n : undefined\n );\n }\n\n return (\n <IntlProvider locale={locale} now={now} {...rest}>\n {children}\n </IntlProvider>\n );\n}\n"],"names":["_excluded","NextIntlClientProvider","_ref","children","locale","now","rest","_objectWithoutPropertiesLoose","router","useRouter","error","Date","Error","process","env","NODE_ENV","undefined","React","createElement","IntlProvider","_extends"],"mappings":";;;;;AAAa,IAAAA,SAAA,GAAA,CAAA,UAAA,EAAA,QAAA,EAAA,KAAA,CAAA,CAAA;AAYW,SAAAC,sBAAsBA,CAAAC,IAAA,EAKtC;AAAA,EAAA,IAJNC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,GAAG,GAAAH,IAAA,CAAHG,GAAG;AACAC,IAAAA,IAAI,GAAAC,6BAAA,CAAAL,IAAA,EAAAF,SAAA,CAAA,CAAA;AAEP,EAAA,IAAIQ,MAAM,CAAA;EACV,IAAI;AACF;AACA;IACAA,MAAM,GAAGC,SAAS,EAAE,CAAA;GACrB,CAAC,OAAOC,KAAK,EAAE;AACd;AAAA,GAAA;AAGF;AACA;AACA,EAAA,IAAI,CAACN,MAAM,IAAII,MAAM,EAAE;IACrBJ,MAAM,GAAGI,MAAM,CAACJ,MAAM,CAAA;AACvB,GAAA;AAED;AACA;AACA;AACA,EAAA,IAAI,OAAOC,GAAG,KAAK,QAAQ,EAAE;AAC3BA,IAAAA,GAAG,GAAG,IAAIM,IAAI,CAACN,GAAG,CAAC,CAAA;AACpB,GAAA;EAED,IAAI,CAACD,MAAM,EAAE;AACX,IAAA,MAAM,IAAIQ,KAAK,CACbC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,GACjC,+MAA+M,GAC/MC,SAAS,CACd,CAAA;AACF,GAAA;AAED,EAAA,OACEC,KAAC,CAAAC,aAAA,CAAAC,YAAY,EAAAC,QAAA,CAAA;AAAChB,IAAAA,MAAM,EAAEA,MAAM;AAAEC,IAAAA,GAAG,EAAEA,GAAAA;GAASC,EAAAA,IAAI,CAC7CH,EAAAA,QAAQ,CACI,CAAA;AAEnB;;;;"}
@@ -1,15 +0,0 @@
1
- /// <reference types="node" />
2
- import { UrlObject } from 'url';
3
- import NextLink from 'next/link';
4
- import { ComponentProps } from 'react';
5
- type Href = ComponentProps<typeof NextLink>['href'];
6
- export declare function isRelativeHref(href: Href): boolean;
7
- export declare function isLocalHref(href: Href): boolean;
8
- export declare function localizeHref(href: string, locale: string, defaultLocale: string, pathname: string): string;
9
- export declare function localizeHref(href: UrlObject | string, locale: string, defaultLocale: string, pathname: string): UrlObject | string;
10
- export declare function prefixHref(href: string, locale: string): string;
11
- export declare function prefixHref(href: UrlObject | string, locale: string): UrlObject | string;
12
- export declare function unlocalizePathname(pathname: string, locale: string): string;
13
- export declare function localizePathname(locale: string, pathname: string): string;
14
- export declare function hasPathnamePrefixed(locale: string, pathname: string): boolean;
15
- export {};
@@ -1,4 +0,0 @@
1
- import { ComponentProps } from 'react';
2
- import NextIntlClientProvider_ from '../shared/NextIntlClientProvider';
3
- /** @deprecated Should be imported from `next-intl`, not `next-intl/client`. */
4
- export default function NextIntlClientProvider(props: ComponentProps<typeof NextIntlClientProvider_>): JSX.Element;
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import NextIntlClientProvider_ from '../shared/NextIntlClientProvider';
3
- let hasWarned = false;
4
- /** @deprecated Should be imported from `next-intl`, not `next-intl/client`. */
5
- export default function NextIntlClientProvider(props) {
6
- if (!hasWarned) {
7
- hasWarned = true;
8
- console.warn(`
9
- Importing \`NextIntlClientProvider\` from \`next-intl/client\` is deprecated. Please update the import:
10
-
11
- import {NextIntlClientProvider} from 'next-intl';
12
- `);
13
- }
14
- return React.createElement(NextIntlClientProvider_, { ...props });
15
- }
16
- //# sourceMappingURL=NextIntlClientProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NextIntlClientProvider.js","sourceRoot":"","sources":["../../../src/client/NextIntlClientProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuB,MAAM,OAAO,CAAC;AAC5C,OAAO,uBAAuB,MAAM,kCAAkC,CAAC;AAEvE,IAAI,SAAS,GAAG,KAAK,CAAC;AACtB,+EAA+E;AAC/E,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,KAAqD;IAErD,IAAI,CAAC,SAAS,EAAE;QACd,SAAS,GAAG,IAAI,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC;;;;CAIhB,CAAC,CAAC;KACA;IACD,OAAO,oBAAC,uBAAuB,OAAK,KAAK,GAAI,CAAC;AAChD,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Client-only APIs available via `next-intl/client`.
3
- */
4
- export { default as useRouter } from './useRouter';
5
- export { default as usePathname } from './usePathname';
6
- export { default as NextIntlClientProvider } from './NextIntlClientProvider';
@@ -1,8 +0,0 @@
1
- /**
2
- * Client-only APIs available via `next-intl/client`.
3
- */
4
- export { default as useRouter } from './useRouter';
5
- export { default as usePathname } from './usePathname';
6
- // Legacy export (deprecation is handled by component)
7
- export { default as NextIntlClientProvider } from './NextIntlClientProvider';
8
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,aAAa,CAAC;AACjD,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,eAAe,CAAC;AAErD,sDAAsD;AACtD,OAAO,EAAC,OAAO,IAAI,sBAAsB,EAAC,MAAM,0BAA0B,CAAC"}
@@ -1 +0,0 @@
1
- export default function useClientLocale(): string;
@@ -1,18 +0,0 @@
1
- import { useParams } from 'next/navigation';
2
- import { useLocale } from 'use-intl';
3
- import { LOCALE_SEGMENT_NAME } from '../shared/constants';
4
- export default function useClientLocale() {
5
- let locale;
6
- // The types aren't entirely correct here. Outside of Next.js
7
- // `useParams` can be called, but the return type is `null`.
8
- const params = useParams();
9
- if (typeof (params === null || params === void 0 ? void 0 : params[LOCALE_SEGMENT_NAME]) === 'string') {
10
- locale = params[LOCALE_SEGMENT_NAME];
11
- }
12
- else {
13
- // eslint-disable-next-line react-hooks/rules-of-hooks -- Reading from context conditionally is fine
14
- locale = useLocale();
15
- }
16
- return locale;
17
- }
18
- //# sourceMappingURL=useClientLocale.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useClientLocale.js","sourceRoot":"","sources":["../../../src/client/useClientLocale.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AACnC,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AAExD,MAAM,CAAC,OAAO,UAAU,eAAe;IACrC,IAAI,MAAM,CAAC;IAEX,6DAA6D;IAC7D,4DAA4D;IAC5D,MAAM,MAAM,GAAG,SAAS,EAAyC,CAAC;IAElE,IAAI,OAAO,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAG,mBAAmB,CAAC,CAAA,KAAK,QAAQ,EAAE;QACrD,MAAM,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;KACtC;SAAM;QACL,oGAAoG;QACpG,MAAM,GAAG,SAAS,EAAE,CAAC;KACtB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,34 +0,0 @@
1
- 'use client';
2
- import { usePathname as useNextPathname } from 'next/navigation';
3
- import { useMemo } from 'react';
4
- import { hasPathnamePrefixed, unlocalizePathname } from '../shared/utils';
5
- import useClientLocale from './useClientLocale';
6
- /**
7
- * Returns the pathname without a potential locale prefix.
8
- *
9
- * @example
10
- * ```tsx
11
- * 'use client';
12
- *
13
- * import {usePathname} from 'next-intl/client';
14
- *
15
- * // When the user is on `/en`, this will be `/`
16
- * const pathname = usePathname();
17
- * ```
18
- */
19
- export default function usePathname() {
20
- // The types aren't entirely correct here. Outside of Next.js
21
- // `useParams` can be called, but the return type is `null`.
22
- const pathname = useNextPathname();
23
- const locale = useClientLocale();
24
- return useMemo(() => {
25
- if (!pathname)
26
- return pathname;
27
- const isPathnamePrefixed = hasPathnamePrefixed(locale, pathname);
28
- const unlocalizedPathname = isPathnamePrefixed
29
- ? unlocalizePathname(pathname, locale)
30
- : pathname;
31
- return unlocalizedPathname;
32
- }, [locale, pathname]);
33
- }
34
- //# sourceMappingURL=usePathname.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePathname.js","sourceRoot":"","sources":["../../../src/client/usePathname.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAC,WAAW,IAAI,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,mBAAmB,EAAE,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AACxE,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW;IACjC,6DAA6D;IAC7D,4DAA4D;IAC5D,MAAM,QAAQ,GAAG,eAAe,EAExB,CAAC;IAET,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;IAEjC,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,IAAI,CAAC,QAAQ;YAAE,OAAO,QAA8C,CAAC;QAErE,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACjE,MAAM,mBAAmB,GAAG,kBAAkB;YAC5C,CAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE,MAAM,CAAC;YACtC,CAAC,CAAC,QAAQ,CAAC;QAEb,OAAO,mBAAmB,CAAC;IAC7B,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzB,CAAC"}
@@ -1,31 +0,0 @@
1
- type IntlNavigateOptions = {
2
- locale?: string;
3
- };
4
- /**
5
- * Returns a wrapped instance of `useRouter` from `next/navigation` that
6
- * will automatically localize the `href` parameters it receives.
7
- *
8
- * @example
9
- * ```tsx
10
- * 'use client';
11
- *
12
- * import {useRouter} from 'next-intl/client';
13
- *
14
- * const router = useRouter();
15
- *
16
- * // When the user is on `/en`, the router will navigate to `/en/about`
17
- * router.push('/about');
18
- *
19
- * // Optionally, you can switch the locale by passing the second argument
20
- * router.push('/about', {locale: 'de'});
21
- * ```
22
- */
23
- export default function useRouter(): {
24
- push(href: string, options?: (import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions & IntlNavigateOptions) | undefined): void;
25
- replace(href: string, options?: (import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions & IntlNavigateOptions) | undefined): void;
26
- prefetch(href: string, options?: (import("next/dist/shared/lib/app-router-context.shared-runtime").PrefetchOptions & IntlNavigateOptions) | undefined): void;
27
- back(): void;
28
- forward(): void;
29
- refresh(): void;
30
- };
31
- export {};
@@ -1,61 +0,0 @@
1
- import { useRouter as useNextRouter } from 'next/navigation';
2
- import { useMemo } from 'react';
3
- import { localizeHref } from '../shared/utils';
4
- import useClientLocale from './useClientLocale';
5
- /**
6
- * Returns a wrapped instance of `useRouter` from `next/navigation` that
7
- * will automatically localize the `href` parameters it receives.
8
- *
9
- * @example
10
- * ```tsx
11
- * 'use client';
12
- *
13
- * import {useRouter} from 'next-intl/client';
14
- *
15
- * const router = useRouter();
16
- *
17
- * // When the user is on `/en`, the router will navigate to `/en/about`
18
- * router.push('/about');
19
- *
20
- * // Optionally, you can switch the locale by passing the second argument
21
- * router.push('/about', {locale: 'de'});
22
- * ```
23
- */
24
- export default function useRouter() {
25
- const router = useNextRouter();
26
- const locale = useClientLocale();
27
- return useMemo(() => {
28
- function localize(href, nextLocale) {
29
- return localizeHref(href, nextLocale || locale, locale, window.location.pathname);
30
- }
31
- return {
32
- ...router,
33
- push(href, options) {
34
- const { locale: nextLocale, ...rest } = options || {};
35
- const args = [localize(href, nextLocale)];
36
- if (Object.keys(rest).length > 0) {
37
- args.push(rest);
38
- }
39
- return router.push(...args);
40
- },
41
- replace(href, options) {
42
- const { locale: nextLocale, ...rest } = options || {};
43
- const args = [localize(href, nextLocale)];
44
- if (Object.keys(rest).length > 0) {
45
- args.push(rest);
46
- }
47
- return router.replace(...args);
48
- },
49
- prefetch(href, options) {
50
- const { locale: nextLocale, ...rest } = options || {};
51
- const args = [localize(href, nextLocale)];
52
- if (Object.keys(rest).length > 0) {
53
- // @ts-expect-error TypeScript thinks `rest` can be an empty object
54
- args.push(rest);
55
- }
56
- return router.prefetch(...args);
57
- }
58
- };
59
- }, [locale, router]);
60
- }
61
- //# sourceMappingURL=useRouter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useRouter.js","sourceRoot":"","sources":["../../../src/client/useRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,IAAI,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAMhD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;IAEjC,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,SAAS,QAAQ,CAAC,IAAY,EAAE,UAAmB;YACjD,OAAO,YAAY,CACjB,IAAI,EACJ,UAAU,IAAI,MAAM,EACpB,MAAM,EACN,MAAM,CAAC,QAAQ,CAAC,QAAQ,CACzB,CAAC;QACJ,CAAC;QAED,OAAO;YACL,GAAG,MAAM;YACT,IAAI,CACF,IAAY,EACZ,OAAiE;gBAEjE,MAAM,EAAC,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,EAAC,GAAG,OAAO,IAAI,EAAE,CAAC;gBACpD,MAAM,IAAI,GAGN,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;gBACjC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;oBAChC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBACjB;gBACD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;YAC9B,CAAC;YAED,OAAO,CACL,IAAY,EACZ,OAAoE;gBAEpE,MAAM,EAAC,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,EAAC,GAAG,OAAO,IAAI,EAAE,CAAC;gBACpD,MAAM,IAAI,GAGN,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;gBACjC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;oBAChC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBACjB;gBACD,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;YACjC,CAAC;YAED,QAAQ,CACN,IAAY,EACZ,OAAqE;gBAErE,MAAM,EAAC,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,EAAC,GAAG,OAAO,IAAI,EAAE,CAAC;gBACpD,MAAM,IAAI,GAGN,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;gBACjC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;oBAChC,mEAAmE;oBACnE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBACjB;gBACD,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;YAClC,CAAC;SACF,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AACvB,CAAC"}
package/dist/src/index.js DELETED
@@ -1,9 +0,0 @@
1
- /**
2
- * This is the default entry file when consumers import from
3
- * 'next-intl'. We use the client APIs in this case.
4
- *
5
- * Note that the `react-server` environment (i.e. RSC) imports
6
- * from `./react-server` instead.
7
- */
8
- export * from './react-client';
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,gBAAgB,CAAC"}
@@ -1,27 +0,0 @@
1
- import React, { ComponentProps } from 'react';
2
- import BaseLink from '../shared/BaseLink';
3
- type Props = Omit<ComponentProps<typeof BaseLink>, 'locale'> & {
4
- locale?: string;
5
- };
6
- /**
7
- * Wraps `next/link` and prefixes the `href` with the current locale if
8
- * necessary.
9
- *
10
- * @example
11
- * ```tsx
12
- * import {Link} from 'next-intl';
13
- *
14
- * // When the user is on `/en`, the link will point to `/en/about`
15
- * <Link href="/about">About</Link>
16
- *
17
- * // You can override the `locale` to switch to another language
18
- * <Link href="/" locale="de">Switch to German</Link>
19
- * ```
20
- *
21
- * Note that when a `locale` prop is passed to switch the locale, the `prefetch`
22
- * prop is not supported. This is because Next.js would prefetch the page and
23
- * the `set-cookie` response header would cause the locale cookie on the current
24
- * page to be overwritten before the user even decides to change the locale.
25
- */
26
- declare const _default: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
27
- export default _default;
@@ -1,29 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import useClientLocale from '../client/useClientLocale';
3
- import BaseLink from '../shared/BaseLink';
4
- function Link({ locale, ...rest }, ref) {
5
- const defaultLocale = useClientLocale();
6
- return React.createElement(BaseLink, { ref: ref, locale: locale || defaultLocale, ...rest });
7
- }
8
- /**
9
- * Wraps `next/link` and prefixes the `href` with the current locale if
10
- * necessary.
11
- *
12
- * @example
13
- * ```tsx
14
- * import {Link} from 'next-intl';
15
- *
16
- * // When the user is on `/en`, the link will point to `/en/about`
17
- * <Link href="/about">About</Link>
18
- *
19
- * // You can override the `locale` to switch to another language
20
- * <Link href="/" locale="de">Switch to German</Link>
21
- * ```
22
- *
23
- * Note that when a `locale` prop is passed to switch the locale, the `prefetch`
24
- * prop is not supported. This is because Next.js would prefetch the page and
25
- * the `set-cookie` response header would cause the locale cookie on the current
26
- * page to be overwritten before the user even decides to change the locale.
27
- */
28
- export default forwardRef(Link);
29
- //# sourceMappingURL=Link.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Link.js","sourceRoot":"","sources":["../../../src/link/Link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,UAAU,EAAC,MAAM,OAAO,CAAC;AACxD,OAAO,eAAe,MAAM,2BAA2B,CAAC;AACxD,OAAO,QAAQ,MAAM,oBAAoB,CAAC;AAM1C,SAAS,IAAI,CAAC,EAAC,MAAM,EAAE,GAAG,IAAI,EAAQ,EAAE,GAAiB;IACvD,MAAM,aAAa,GAAG,eAAe,EAAE,CAAC;IACxC,OAAO,oBAAC,QAAQ,IAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,IAAI,aAAa,KAAM,IAAI,GAAI,CAAC;AAC3E,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAe,UAAU,CAAC,IAAI,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export { default } from './Link';