Skip to content

Commit 378dfdd

Browse files
authored
feat: add next-international framework (#1007)
* feat: next-international framework * feat: improve scopedT regex matching * feat: add detect hard string function
1 parent 289af25 commit 378dfdd

File tree

17 files changed

+517
-1
lines changed

17 files changed

+517
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/node_modules
2+
/.next/
3+
.DS_Store
4+
tsconfig.tsbuildinfo
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"i18n-ally.localesPaths": "src/locales",
3+
"i18n-ally.enabledFrameworks": ["next-international"],
4+
"eslint.enable": false,
5+
"i18n-ally.enabledParsers": ["ts"],
6+
"i18n-ally.keystyle": "flat"
7+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/image-types/global" />
3+
4+
// NOTE: This file should not be edited
5+
// see https://nextjs.org/docs/basic-features/typescript for more information.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
i18n: {
3+
locales: ["en", "fr"],
4+
defaultLocale: "en"
5+
}
6+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "next-international",
3+
"version": "0.0.1",
4+
"private": true,
5+
"scripts": {
6+
"dev": "next dev",
7+
"lint": "tsc",
8+
"build": "next build",
9+
"start": "next start"
10+
},
11+
"dependencies": {
12+
"next": "^13.4.0",
13+
"next-international": "^0.9.5",
14+
"react": "^18.2.0",
15+
"react-dom": "^18.2.0"
16+
},
17+
"devDependencies": {
18+
"@types/node": "^17.0.23",
19+
"@types/react": "^18.2.5",
20+
"typescript": "^5.0.0"
21+
}
22+
}
14.7 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
hello: "Hello",
3+
"hello.world": "Hello world!",
4+
welcome: "Hello {name}!",
5+
"child.hello": "Hello child!"
6+
} as const;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
hello: "Bonjour",
3+
"hello.world": "Bonjour Monde!",
4+
welcome: "Bonjour {name}!",
5+
"child.hello": "Bonjour enfant!"
6+
} as const;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { createI18n } from 'next-international'
2+
3+
export const { useI18n, useScopedI18n, I18nProvider, getLocaleProps } = createI18n({
4+
en: () => import('./en'),
5+
fr: () => import('./fr')
6+
})
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { I18nProvider } from '../locales'
2+
import { AppProps } from 'next/app'
3+
4+
export default function App({ Component, pageProps }: AppProps) {
5+
return (
6+
<I18nProvider locale={pageProps.locale}>
7+
<Component {...pageProps} />
8+
</I18nProvider>
9+
)
10+
}

0 commit comments

Comments
 (0)