Coder Social home page Coder Social logo

next-intl's People

Contributors

afonsovreis avatar jgradim avatar ritazoliveira avatar ruipneves avatar satazor avatar shmidtelson avatar tiagodinis avatar ubmit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

next-intl's Issues

How to use multiple plugins with withNextIntl()({ ...nextConfig }) ?

it seems withNextIntl only accepts direct configurations, not plugins!

ex: I attempt to wrap current plugins with withNextIntl but it throws errors

const withBundleAnalyzer = require('@next/bundle-analyzer')({
  enabled: process.env.ANALYZE === 'true',
});

const withCSS = require('@zeit/next-css');
const withSass = require('@zeit/next-sass');

const nextConfig = {
  // target: 'serverless',
  webpack(config) {
    config.module.rules.push({
      test: /\.(eot|woff|woff2|ttf|svg|png|jpg|gif)$/,
      use: {
        loader: 'url-loader',
        options: {
          limit: 100000,
          name: '[name].[ext]',
        },
      },
    });

    return config;
  },
};

module.exports = withBundleAnalyzer(withSass(withCSS(nextConfig)));

import 2 json file and provide them as message

hello next intl works great with pages with server side props or get static props
how ever
i have header.json. (translation for header layout)
page.json (translation for page)

i can import page.json as server side props but how about the header+ its on eveypage

Support default locale to allow fallback if message ID not existent in target locale

For example, a webpage has two locales, en and fr and was first developed with en with future translations in mind, the website will probably have partial fr at various points in development, e.g. for testing implementation of next-intl.

Supporting a fallback feature would make it so message IDs that aren't present in the fr locale would fallback to their respective messages in en, after this locale had been set as the fallback default.

Set lang attribute in HTML

This needs to be done in two places:

  • In _document.js
  • In runtime (under the hood?), when the language is changed

Add pathname / subfolder policy

This policy would match against pathnames that start with locales, such as /pt/about.

Things to consider:

  • Perhaps it would be nice to have slug property in locales that policies such as this one could use (e.g.: to make prettier URLs).
  • Will probably require us to have a custom <Link> component.
  • The act method of this policy would listen to URL changes to check if the pathname need to be corrected with replaceState.

clientDeferred.catch is not a function

The latest version (v2.0.1) introduced a bug by calling catch from the result of p-defer.

NextIntlWebpackPlugin.clientDeferred.catch(() => {});

This results in the following error:

TypeError: NextIntlWebpackPlugin.clientDeferred.catch is not a function
    at NextIntlWebpackPlugin.apply (<DIR>/next-with-moxy/node_modules/@moxy/next-intl/lib/plugin/NextIntlWebpackPlugin.js:41:49)
    at webpack (<DIR>/next-with-moxy/node_modules/webpack/lib/webpack.js:51:13)
    at <DIR>/next-with-moxy/node_modules/webpack/lib/webpack.js:36:39
    at Array.map (<anonymous>)
    at webpack (<DIR>/next-with-moxy/node_modules/webpack/lib/webpack.js:36:24)
    at HotReloader.start (<DIR>/next-with-moxy/node_modules/next/dist/server/hot-reloader.js:14:1858)
    at async DevServer.prepare (<DIR>/next-with-moxy/node_modules/next/dist/server/next-dev-server.js:6:1541)
    at async <DIR>/next-with-moxy/node_modules/next/dist/cli/next-dev.js:22:359

I don't know what bug you were trying to solve by adding that line, but wasn't it supposed to be .promise.catch(...?

NextIntlWebpackPlugin.clientDeferred.promise.catch(() => {});

If so, let me know and I'll do the PR ๐Ÿ˜„

Module not found: Can't resolve '@formatjs/intl-displaynames/polyfill-locales'

I just tried to use this plugin in my app, which is a very basic app.

I get the following error when I try to do npm run dev

error - ./node_modules/@moxy/next-intl/es/polyfill.browser.js:15:0
Module not found: Can't resolve '@formatjs/intl-displaynames/polyfill-locales'

I followed all the steps required not sure why I'm getting the error.

intl object

I was getting intl object in previous version. The question is how should i get "intl" object?

Add ability to be notified whenever a locale change or failed to change

Currently, one knows that a locale has changed whenever we call changeLocale and attaching to the promise rejection or whenever we use the NextIntlConsumer or the useNextIntl hook, because they are re-rendered.

However, it would be nice to register a listener that would cover the case of a locale changing because a policy has changed as well. Moreover, one could also need to register an error handler for whenever a locale change has failed, e.g.: failed to fetch the locale messages. This can be done with a different handler or the same handler by making it similar to node ((err, locale) => {}).

__NEXT_INTL_POLYFILL_URL__ is not defined

Hello, i did everything according to the guide. In development mode I got this error
> Ready on http://127.0.0.1:3000 [ event ] build page: /404 [ wait ] compiling ... [ event ] build page: / [ error ] ReferenceError: __NEXT_INTL_POLYFILL_URL__ is not defined

Everything worked after disabling "use strict" in tsconfig. I'm not sure if this is the best way.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.