• Stars
    star
    2,442
  • Rank 18,834 (Top 0.4 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created about 4 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🌐 Internationalization (i18n) for Next.js



next-intl


Internationalization (i18n) for Next.js that gets out of your way.

Gzipped size Tree shaking supported


πŸ“£ Support for Next.js 13 and the App Router has arrived β†’


Features

Internationalization is an essential part of the user experience. next-intl gives you everything you need to get language subtleties right and has always got your back whenever you need to fine-tune a translation.

  • 🌟 ICU message syntax: Localize your messages with interpolation, plurals, ordinal pluralization, enum-based label selection, and rich text.
  • πŸ“… Dates, times & numbers: Apply appropriate formatting without worrying about server/client differences like time zones.
  • βœ… Type-safe: Speed up development with autocompletion for message keys and catch typos early with compile-time checks.
  • πŸ’‘ Hooks-only API: Learn a single API that can be used across your code base to turn translations into plain strings or rich text.
  • πŸš€ Fast: Get the best performance from your app by supporting internationalization on both static and dynamic pages.
  • βš”οΈ Standards-based: Use the best parts of built-in JavaScript APIs and supplemental lower-level APIs from Format.JS.

What does it look like?

This library is based on the premise that messages can be grouped by namespaces (typically a component name).

// UserDetails.tsx
import {useTranslations, useFormatter} from 'next-intl';
 
function UserDetails({user}) {
  const t = useTranslations('UserDetails');
  const format = useFormatter();
 
  return (
    <section>
      <h2>{t('title')}</h2>
      <p>{t('followers', {count: user.followers.length})}</p>
      <p>{t('lastSeen', {time: format.relativeTime(user.lastSeen)})</p>
      <Image alt={t('portrait', {username: user.name})} src={user.portrait} />
    </section>
  );
}
// en.json
{
  "UserDetails": {
    "title": "User details",
    "followers": "{count, plural, ↡
                    =0 {No followers yet} ↡
                    =1 {One follower} ↡
                    other {# followers} ↡
                  }",
    "lastSeen": "Last seen {time}",
    "portrait": "Portrait of {username}"
  }
}

β†’ Read the docs

More Repositories

1

action-semantic-pull-request

A GitHub Action that ensures that your PR title matches the Conventional Commits spec
JavaScript
964
star
2

next-query-params

Convenient state management of query parameters in Next.js apps
TypeScript
163
star
3

next-client-script

Supercharge the performance of your Next.js apps by using a minimal client runtime πŸš€
TypeScript
77
star
4

react-keep-state

Make React components keep their state, even if they're unmounted.
JavaScript
30
star
5

dokku-node-hello-world

An instruction on how to deploy a node app to a server that is running dokku.
JavaScript
29
star
6

react-hooks

A collection of commonly used hooks for React apps
TypeScript
16
star
7

friends-ui

An animation experiment.
JavaScript
13
star
8

street-photography-viewer

TypeScript
12
star
9

atom-format-javascript-comment

Formats your JavaScript comments
JavaScript
8
star
10

gulp-wordpress-template

A very basic proof-of-concept, showing that gulp can work as a replacement for MAMP/XAMPP and also extend their features for SASS compiling for example.
PHP
7
star
11

multi-sitemap

Painless creation of large dynamic sitemaps that consist of multiple files
TypeScript
6
star
12

next-intl-example-rsc

TypeScript
6
star
13

amann.work

My personal website featuring some projects I've worked on.
JavaScript
4
star
14

graphql-filter-fragment

Filters a data structure by a GraphQL fragment
TypeScript
3
star
15

jest-globals-bug

JavaScript
3
star
16

animated-routes

JavaScript
2
star
17

semantic-release-test

Only for personal testing …
JavaScript
2
star
18

webpack-top-level-await

JavaScript
2
star
19

ea-ss24-sem4

TypeScript
2
star
20

next-dynamic-loading

CSS
1
star
21

eslint-plugin-react-test

TypeScript
1
star
22

nextjs-tsconfig-paths

JavaScript
1
star
23

nextjs-commerce-example

TypeScript
1
star
24

babel-preset-react-hot

Babel preset for React hot module replacement and error catching
JavaScript
1
star
25

nextjs-server-context

TypeScript
1
star
26

next-compile-bug

TypeScript
1
star
27

photo-gallery

A gesture-based photo gallery
SCSS
1
star
28

nextjs-bug-use-server

JavaScript
1
star
29

nextjs13-query-params

TypeScript
1
star
30

vite-plugin-pretty-css-modules

Use prettier generated class names in development, while applying minification in production.
TypeScript
1
star
31

nextjs-bugrepro-sitemap

TypeScript
1
star
32

next-intl-mixed-routing

TypeScript
1
star
33

nextjs-bug-repro-middleware-import

TypeScript
1
star
34

nodejs-esm-test

JavaScript
1
star