xairoo / next-i18next-static-site Goto Github PK
View Code? Open in Web Editor NEWi18next solution for static sites build with Next.js (static HTML export / next export)
i18next solution for static sites build with Next.js (static HTML export / next export)
_app.js wrapped up in I18nProvider can't be statically generated. What's the point? Or am I doing anything wrong that my is empty?
Hello, thanks for creating this package!
I wonder how I should integrate this with the new layout.js that replaced the _app.js file.
Also, it's possible to translate the contents of the metadata too?
Can you point me the directions?
The default layout.js:
import { Inter } from 'next/font/google'
import './globals.css'
const inter = Inter({ subsets: ['latin'] })
export const metadata = {
title: 'Create Next App',
description: 'Generated by create next app',
}
export default function RootLayout({ children }) {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
</html>
)
}
Thank you!
Hi,
I do not see any option to hide the language path of the default language from the URL
Example:
Changing the locales file will result in a full reload instead of fast refresh/hot reloading.
Hello and thanks for this package
I don't know why but looking at the network tab of the devtools, my app is stuck in infinite loop, requesting default locale json too many times at homepage.
Do you have any ideas what I did wrong ?
While trying our your lib, I am wondering if I need to install the following packages:
Do I need to add these to my project?
Thanks for the clarification ๐
The language detection should fallback to defaultLanguage
if the detected language is not present in languages
.
Putting environmental variables in nextjs config is not working, it only works using .env.local file
next.config.js example:
env: {
NEXT_PUBLIC_I18N_LANGUAGES: '["en", "de"]',
NEXT_PUBLIC_I18N_DEFAULT_LANGUAGE: "en",
NEXT_PUBLIC_I18N_NAMESPACES: '["common", "meta", "error"]',
NEXT_PUBLIC_I18N_DEFAULT_NAMESPACE: "common",
},
This will throw
> next dev
โฒ Next.js 13.5.6
- Local: http://localhost:3000
โ Ready in 4.1s
โ Compiled /[lang] in 807ms (397 modules)
Error: NEXT_PUBLIC_I18N_LANGUAGES not set
at Object.<anonymous> (/Users/lunafreya/Programming/WebstormProjects/personal-portfolio/node_modules/next-i18next-static-site/dist/index.js:82:11)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Module.require (node:internal/modules/cjs/loader:1235:19)
only works in .env.local file
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.