Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: next-intl@4 #1412

Draft
wants to merge 46 commits into
base: main
Choose a base branch
from
Draft

feat!: next-intl@4 #1412

wants to merge 46 commits into from

Commits on Jun 20, 2024

  1. Configuration menu
    Copy the full SHA
    a8fb0e3 View commit details
    Browse the repository at this point in the history
  2. Improve docs [skip ci]

    amannn committed Jun 20, 2024
    Configuration menu
    Copy the full SHA
    cf3f8b0 View commit details
    Browse the repository at this point in the history
  3. fix: Try out updated credits

    amannn committed Jun 20, 2024
    Configuration menu
    Copy the full SHA
    4fd9b20 View commit details
    Browse the repository at this point in the history
  4. v3.15.3-canary.0

    amannn committed Jun 20, 2024
    Configuration menu
    Copy the full SHA
    47239f9 View commit details
    Browse the repository at this point in the history
  5. Revert "v3.15.3-canary.0"

    This reverts commit 47239f9.
    amannn committed Jun 20, 2024
    Configuration menu
    Copy the full SHA
    0d60a72 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    c459669 View commit details
    Browse the repository at this point in the history

Commits on Jun 26, 2024

  1. fix: Prefer more specific routes in usePathname when detecting the …

    …currently active pathname for localized pathnames
    amannn committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    8d3ab38 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    605c9a6 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    cb15046 View commit details
    Browse the repository at this point in the history

Commits on Jul 11, 2024

  1. Merge remote-tracking branch 'origin/main' into canary

    # Conflicts:
    #	packages/next-intl/src/middleware/utils.test.tsx
    #	packages/next-intl/src/shared/utils.test.tsx
    amannn committed Jul 11, 2024
    Configuration menu
    Copy the full SHA
    11262b8 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7976376 View commit details
    Browse the repository at this point in the history
  3. fix: Release please?

    amannn committed Jul 11, 2024
    Configuration menu
    Copy the full SHA
    b352c10 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    cba448a View commit details
    Browse the repository at this point in the history

Commits on Jul 12, 2024

  1. Configuration menu
    Copy the full SHA
    0c670b2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5dc7f53 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    11dcbcc View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1b074da View commit details
    Browse the repository at this point in the history

Commits on Jul 15, 2024

  1. Configuration menu
    Copy the full SHA
    e98682b View commit details
    Browse the repository at this point in the history

Commits on Aug 23, 2024

  1. Configuration menu
    Copy the full SHA
    7c6f533 View commit details
    Browse the repository at this point in the history

Commits on Aug 26, 2024

  1. feat!: Automatically inherit formats when NextIntlClientProvider

    …is rendered from a Server Component (#1191)
    
    This should ease the transition from Server to Client Components, as you
    don't have to manually pass this prop anymore. If you've previously
    passed this prop manually, you can remove this assignment now.
    
    If this is not desired (e.g. because you have a large `formats` object
    that you don't want to pass to the client side), you can manually
    opt-out via `formats={{}}` on `NextIntlClientProvider` in order to not
    provide any formats on the client side.
    
    **BREAKING CHANGE:** There's a very rare chance where this can break
    existing behavior. If you're rendering `NextIntlClientProvider` in a
    Server Component, you rely on static rendering, but you're not using
    `unstable_setRequestLocale` (i.e. you're using hooks like
    `useTranslations` exclusively in Client Components), this can opt your
    page into dynamic rendering. If this affects you, please provide the
    `formats` prop explicitly to `NextIntlClientProvider`.
    amannn authored Aug 26, 2024
    Configuration menu
    Copy the full SHA
    8b4c7c4 View commit details
    Browse the repository at this point in the history

Commits on Oct 9, 2024

  1. feat!: Inherit context between providers (#1413)

    If you have nested providers, previously only the configuration of the
    innermost one would be applied.
    
    With this change, configuration is now passed from one provider to the
    next, while allowing to override individual props.
    
    **BREAKING CHANGE:** There's a very rare chance that this change affects
    your app, but in case you've previously relied on providers not
    inheriting from each other, you now have to reset props manually in case
    you want to retain the prev. behavior.
    amannn authored Oct 9, 2024
    Configuration menu
    Copy the full SHA
    d80d691 View commit details
    Browse the repository at this point in the history
  2. Merge remote-tracking branch 'origin/canary' into HEAD

    # Conflicts:
    #	packages/next-intl/.size-limit.ts
    amannn committed Oct 9, 2024
    Configuration menu
    Copy the full SHA
    8158de4 View commit details
    Browse the repository at this point in the history

Commits on Oct 24, 2024

  1. Merge remote-tracking branch 'origin/canary' into v4

    # Conflicts:
    #	docs/src/pages/docs/usage/configuration.mdx
    #	packages/next-intl/.size-limit.ts
    #	packages/use-intl/.size-limit.ts
    amannn committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    7dd54c1 View commit details
    Browse the repository at this point in the history
  2. fix lint

    amannn committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    ccaef97 View commit details
    Browse the repository at this point in the history
  3. bump size

    amannn committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    25a0dc8 View commit details
    Browse the repository at this point in the history

Commits on Oct 29, 2024

  1. feat!: Make package ESM-only, target modern browsers, use modern JSX …

    …transform (#1470)
    
    **Changes**
    
    1. `next-intl` as well as its base library `use-intl` are now ESM-only.
    With this, the library is now ~7% smaller and provides full support for
    tree shaking. Most tools support ESM out-of-the-box, but some might
    require additional configuration (e.g. Jest might benefit from
    [`next/jest`](https://nextjs.org/docs/app/building-your-application/testing/jest#manual-setup)).
    The only exception is `next-intl/plugin` which is provided both as ESM
    as well as CommonJS due to `next.config.js` still being popular.
    2. Syntax is compiled down to the Browserslist
    [`defaults`](https://github.com/browserslist/browserslist/blob/065c69b0e1e6ad679263d03e22c605830bbc52e5/index.js#L460)
    query, which is a shortcut for `> 0.5%, last 2 versions, Firefox ESR,
    not dead`. The `defaults` query was thoroughly designed by the
    Browserslist community and is considered a reasonable default for modern
    apps. If you target outdated browsers, you can use
    [`transpilePackages`](https://nextjs.org/docs/app/api-reference/next-config-js/transpilePackages)
    in combination with a
    [`browserslist`](https://nextjs.org/docs/architecture/supported-browsers)
    config in Next.js to compile `next-intl` for older browsers.
    3. The minimum React version is 17 now (which supports the modern JSX
    transform)
    amannn authored Oct 29, 2024
    Configuration menu
    Copy the full SHA
    9f4754c View commit details
    Browse the repository at this point in the history
  2. feat!: Remove deprecated APIs (#1479)

    **Changes**
    - Removed deprecated `defaultTranslationValues`
    - Remove deprecated detection of `src/i18n.ts` (use
    `src/i18n/request.ts` instead, or specify a custom path in your Next.js
    config)
    - Removed deprecated export of `Pathnames` from `next-intl/navigation`
    (still available via `next-intl/routing`)
    - Remove deprecated legacy navigation APIs
    `createSharedPathnamesNavigation` and
    `createLocalizedPathnamesNavigation`
    amannn authored Oct 29, 2024
    Configuration menu
    Copy the full SHA
    5b5f0e3 View commit details
    Browse the repository at this point in the history
  3. feat!: Bump minimum required typescript version to 5 for projects u…

    …sing TypeScript (#1481)
    
    If you don't use TypeScript, this change doesn't affect you.
    amannn authored Oct 29, 2024
    Configuration menu
    Copy the full SHA
    eb5bf09 View commit details
    Browse the repository at this point in the history
  4. feat!: Remove deprecated APIs pt. 2 (#1482)

    **Changes**
    - Removed deprecated second argument of `createMiddleware` (use first
    argument instead, ideally via `defineRouting`)
    - Remove deprecated `({locale})` argument in `getRequestConfig` (use
    `({requestLocale})` instead)
    - Remove deprecated `unstable_setRequestLocale` (use `setRequestLocale`
    instead)
    amannn authored Oct 29, 2024
    Configuration menu
    Copy the full SHA
    a6238f4 View commit details
    Browse the repository at this point in the history
  5. feat!: Infer default locale for NextIntlClientProvider from `useP…

    …arams` when rendered on the client side (#1483)
    
    Bumps the Next.js peer dependency to 13.3.
    amannn authored Oct 29, 2024
    Configuration menu
    Copy the full SHA
    829998e View commit details
    Browse the repository at this point in the history
  6. add comment

    amannn committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    a9c35db View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    5402851 View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2024

  1. feat!: Decrease cookie expiration to 5 hours, only set cookie when ne…

    …cessary and only disable cookie if `localeCookie: false` is set (#1487)
    
    **Changes**
    1. The `maxAge` attribute of the locale cookie is decreased from 1 year
    to 5 hours in order to be GDPR-compliant.
    2. The locale cookie is now only set when the user's language doesn't
    match a requested locale. E.g. a user with `accept-language: 'en'` will
    cause a cookie to be set when `/de` is requested to remember the
    preference for `de`.
    3. `localeDetection: false` previously ambiguously also disabled the
    cookie from being set. This is no longer the case. For consistency, you
    can now use the explicit [`localeCookie:
    false`](https://next-intl-docs.vercel.app/docs/routing#locale-cookie)
    option instead.
    
    If you want to increase the cookie expiration, you can use the
    [`maxAge`](https://next-intl-docs.vercel.app/docs/routing#locale-cookie)
    attribute to do so:
    
    ```tsx
    import {defineRouting} from 'next-intl/routing';
     
    export const routing = defineRouting({
      // ...
     
      localeCookie: {
        // Expire in one year
        maxAge: 60 * 60 * 24 * 365
      }
    });
    ```
    amannn authored Oct 30, 2024
    Configuration menu
    Copy the full SHA
    b4e4d1d View commit details
    Browse the repository at this point in the history
  2. feat: Return type-safe IntlMessages from useMessages & `getMessag…

    …es` (#1489)
    
    If consumers use type-safe `IntlMessages`, these will now be used for
    `useMessages` and `getMessages`.
    
    Fixes #1452
    amannn authored Oct 30, 2024
    Configuration menu
    Copy the full SHA
    d83abc2 View commit details
    Browse the repository at this point in the history

Commits on Nov 1, 2024

  1. feat!: Revamp augmented types and add support for typed Locale (#1495)

    **Changes**
    - Revamps the API to augment types by getting rid of the global
    `IntlMessages` and `IntlFormats` in favor of a more general `AppConfig`
    that is scoped to `next-intl`.
    - Adds support for strictly-typing the locale across `useLocale` as well
    as the navigation APIs.
    - Adds `import {Locale} from 'next-intl';` as a convenience API to be
    reused wherever a `locale` is passed around.
    - Add `hasLocale(locales, candidate)` API for simplified checking of
    whether a locale is available with TypeScript.
    - Adds a new `import {Messages} from 'next-intl;` type that corresponds
    to the `Messages` you've provided in `AppConfig` (probably rarely
    needed).
    
    
    **Example:**
    
    ```tsx
    // global.d.ts
    
    import {routing} from '@/i18n/routing';
    import {formats} from '@/i18n/request';
    import en from './messages/en.json';
    
    declare module 'next-intl' {
      interface AppConfig {
        Locale: (typeof routing.locales)[number];
        Formats: typeof formats;
        Messages: typeof en;
      }
    }
    ```
    
    **→ [Proposed
    docs](https://next-intl-docs-git-feat-augmented-config-next-intl.vercel.app/docs/workflows/typescript)**
    
    Fixes #1377
    amannn authored Nov 1, 2024
    Configuration menu
    Copy the full SHA
    a7aaf56 View commit details
    Browse the repository at this point in the history
  2. remove unused file

    amannn committed Nov 1, 2024
    Configuration menu
    Copy the full SHA
    2388c9b View commit details
    Browse the repository at this point in the history

Commits on Nov 7, 2024

  1. feat: Type-safe ICU arguments (#1499)

    ```json
    {
      "UserProfile": {
        "title": "Hello {firstName}"
      }
    }
    ```
    
    ```tsx
    function UserProfile({user}) {
      const t = useTranslations('UserProfile');
     
      // ✖️ Missing argument
      t('title');
     
      // ✅ Argument is provided
      t('title', {firstName: user.firstName});
    }
    ```
    
    **Changes**
    - ICU arguments can now be validated with TypeScript (however, currently
    this is
    [opt-in](https://next-intl-docs-git-feat-type-safe-params-next-intl.vercel.app/docs/workflows/typescript#messages-arguments))
    - `undefined` and `null` are no longer accepted as values for calls to
    `t`—please only provide valid values.
    
    Fixes #410
    amannn authored Nov 7, 2024
    Configuration menu
    Copy the full SHA
    01268f6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0bb75c5 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    dd28ac1 View commit details
    Browse the repository at this point in the history

Commits on Nov 8, 2024

  1. Merge remote-tracking branch 'origin/main' into v4

    # Conflicts:
    #	packages/next-intl/package.json
    #	packages/next-intl/src/navigation/react-client/index.tsx
    #	packages/next-intl/src/routing/index.tsx
    #	packages/next-intl/src/server/react-server/index.tsx
    #	packages/use-intl/package.json
    #	packages/use-intl/src/core/index.tsx
    #	pnpm-lock.yaml
    #	pnpm-workspace.yaml
    amannn committed Nov 8, 2024
    Configuration menu
    Copy the full SHA
    4675f7e View commit details
    Browse the repository at this point in the history
  2. move/rename file

    amannn committed Nov 8, 2024
    Configuration menu
    Copy the full SHA
    c154409 View commit details
    Browse the repository at this point in the history
  3. simplify signature

    amannn committed Nov 8, 2024
    Configuration menu
    Copy the full SHA
    887034d View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ab22a92 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    b9c515e View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    8ac7206 View commit details
    Browse the repository at this point in the history

Commits on Nov 12, 2024

  1. remove outdated constant

    amannn committed Nov 12, 2024
    Configuration menu
    Copy the full SHA
    21f2dac View commit details
    Browse the repository at this point in the history