Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

next-multilingual

Package Overview
Dependencies
Maintainers
1
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-multilingual - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

1

lib/messages/index.js

@@ -118,2 +118,3 @@ "use strict";

__2.log.warn(`unable to format key with identifier \`${key}\` in \`${this.sourceFilePath}\` because it was not found in messages file \`${this.messagesFilePath}\``);
return '';
}

@@ -120,0 +121,0 @@ return message.format(values);

2

package.json
{
"name": "next-multilingual",
"description": "An opinionated end-to-end multilingual solution for Next.js.",
"version": "0.1.1",
"version": "0.1.2",
"license": "MIT",

@@ -6,0 +6,0 @@ "main": "lib/index.js",

@@ -525,2 +525,32 @@ # ![next-multilingual](./assets/next-multilingual-banner.svg)

### Custom Error Pages
Like most site, you will want to leverage Next.js' [custom your error pages](https://nextjs.org/docs/advanced-features/custom-error-page) capability. With `useMessages()`, it's just as easy as creating any other pages. For example, for a `404` error, you can create your `404.tsx`:
```tsx
import { useMessages } from 'next-multilingual/messages';
import { MulLink } from 'next-multilingual/link';
import type { ReactElement } from 'react';
import Layout from '@/layout';
export default function Custom400(): ReactElement {
const messages = useMessages();
return (
<Layout title={messages.format('pageTitle')}>
<h1>{messages.format('pageTitle')}</h1>
<MulLink href="/">
<a>{messages.format('goBack')}</a>
</MulLink>
</Layout>
);
}
```
And of course, your messages, for example `404.en-US.properties`:
```ini
exampleApp.pageNotFoundError.pageTitle = 404 - Page Not Found
exampleApp.pageNotFoundError.goBack = Go back home
```
## Translation process 🈺

@@ -527,0 +557,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc