mirror of
https://github.com/yude-jp/yude.jp
synced 2025-04-21 06:24:51 +09:00
Add translation
This commit is contained in:
parent
8e1a1ae8de
commit
2b4448de81
@ -2,7 +2,7 @@
|
|||||||
"locales": ["en-US", "ja-JP"],
|
"locales": ["en-US", "ja-JP"],
|
||||||
"defaultLocale": "ja-JP",
|
"defaultLocale": "ja-JP",
|
||||||
"pages": {
|
"pages": {
|
||||||
"/": ["index"],
|
"/": ["index", "common"],
|
||||||
"/about": ["about"]
|
"/about": ["about", "common"]
|
||||||
}
|
}
|
||||||
}
|
}
|
4
locales/en-US/common.json
Normal file
4
locales/en-US/common.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"footer": "This page is licensed under the MIT License.",
|
||||||
|
"source": "Source code"
|
||||||
|
}
|
4
locales/ja-JP/common.json
Normal file
4
locales/ja-JP/common.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"footer": "このページは MIT License の下でライセンスされています。",
|
||||||
|
"source": "ソースコード"
|
||||||
|
}
|
@ -1,18 +1,26 @@
|
|||||||
import Head from "next/head"
|
import Head from "next/head"
|
||||||
import Link from "next/link"
|
import Link from "next/link"
|
||||||
import "tailwindcss/tailwind.css";
|
import "tailwindcss/tailwind.css";
|
||||||
|
import useTranslation from 'next-translate/useTranslation'
|
||||||
|
import { useRouter } from 'next/router'
|
||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
|
|
||||||
const Layout = (props) => {
|
const Layout = (props) => {
|
||||||
const { title, children } = props
|
const { title, children } = props
|
||||||
const siteTitle = "yude.jp"
|
const siteTitle = "yude.jp"
|
||||||
|
const router = useRouter()
|
||||||
|
const { locale, locales, defaultLocale, pathname } = router
|
||||||
|
|
||||||
|
const { t, lang } = useTranslation("common")
|
||||||
|
const footer = t('footer')
|
||||||
|
const source = t('source')
|
||||||
return (
|
return (
|
||||||
<div className="page">
|
<div className="page">
|
||||||
<Head>
|
<Head>
|
||||||
<title>{title ? `${title} - ${siteTitle}` : siteTitle}</title>
|
<title>{title ? `${title} - ${siteTitle}` : siteTitle}</title>
|
||||||
<link rel="icon" href="/static/images/favicon.ico" />
|
<link rel="icon" href="/static/images/favicon.ico" />
|
||||||
</Head>
|
</Head>
|
||||||
<body className="bg-white text-black dark:bg-black dark:text-white">
|
<body className="min-h-screen bg-gray-900 text-white">
|
||||||
<main>
|
<main>
|
||||||
<div className="page-main">
|
<div className="page-main">
|
||||||
{children}
|
{children}
|
||||||
@ -24,17 +32,15 @@ const Layout = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
`}</style>
|
`}</style>
|
||||||
<footer>
|
|
||||||
<div className="container mx-auto px-6">
|
<div className="container mx-auto px-6">
|
||||||
<div className="mt-16 border-t-2 border-gray-300 flex flex-col items-center">
|
<div className="mt-16 border-t-2 border-gray-300 flex flex-col items-center">
|
||||||
<div className="sm:w-full text-left py-6">
|
<div className="sm:w-full text-center py-6">
|
||||||
<p className="text-sm text-gray-700 font-bold mb-2">
|
<p className="text-sm font-bold mb-2 text-gray-400">
|
||||||
This page is licensed under the MIT License.
|
{footer} / <Link href="https://github.com/yudemoe/yude.jp"><a>{source}</a></Link>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user