/public/text/brand.js
module.exports = {
starter: {
name: 'Luxi Starter',
desc: 'Luxi Starter - React Starter Template',
prefix: 'luxi',
footerText: 'Luxi Theme All Rights Reserved 2019',
logoText: 'Luxi Theme',
projectName: 'Starter Project',
url: 'luxi.ux-maestro.com',
img: '/public/images/logo.png',
notifMsg: 'Donec sit amet nulla sed arcu pulvinar ultricies commodo id ligula.'
}
};
/pages/_app.js
state.theme
value. Here's the available api:
Key | Type | Available Value | Example |
---|---|---|---|
Color: |
String |
'oceanBlue' ,
'greenLeaf' , 'greyscale' ,
'cloud' , 'violet' ,
etc
|
...appTheme('oceanBlue', themeType), |
Theme mode: |
String |
'light' ,
'dark' ,
|
...appTheme('oceanBlue', 'dark'), |
direction: |
String |
ltr ,
rtl ,
|
direction: 'rtl' |
// file: app/redux/modules/uiReducer.js
state = {
loading: true,
theme: {
...appTheme('greenLeaf', 'dark'),
direction: 'rtl'
}
}
This template us React Youtube a simple react component acting as a thin layer over the YouTube IFrame Player API. To use this feature we recommend to use https in production. If not there will be some warnings in browser console related cookies and security.
You can disable this feature by open /youtube.js
then set set use: false
.
next-i18next.config.js
defaultLocale: 'en'
to other initial locale i.e. defaultLocale: 'id'
for Bahasa Indonesia/public/locales/[localCode]/
. Please create your language preference here and put every your translation text these JSON files:└── public └── locales ├── en | └── common.json └── de └── common.json
/next-i18next.config.js
. Example for English and Deutsch.
locales: ['en', 'de']
pages/about.js
and pages/[locale]/about.js
// pages/about.js
// Use for redirection by following language param [locale]. It will redirect to pages/[locale]/about.js
import { Redirect } from '../lib/redirect';
export default Redirect;
// pages/[locale]/about.js
// It's a real page containing translations or components with translations
// You can translate directly in a page with {t('title')}
import React from 'react';
import { useTranslation } from 'next-i18next';
import { getStaticPaths, makeStaticProps } from '../../lib/getStatic';
export default function About() {
const { t } = useTranslation('common');
return (
<div>
<p>This is the about page</p>
<p>{t('title')}</p>
</div>
);
}
const getStaticProps = makeStaticProps(['common']);
export { getStaticPaths, getStaticProps };
import { useTranslation } from 'next-i18next';
and use the t
function
const { t } = useTranslation('common');
Basically the message value is String. And next step is replace/add every string in components
<h3>
{t('landing-theme:footer_counter')}
<h3>
Or if you put all translations in common.json
<h3>
{t('footer_counter')}
<h3>
// file: /components/MyComponent/SampleComponent.js
import React from 'react';
import { useTranslation } from 'next-i18next';
function SampleComponent(){
const { t } = useTranslation('common');
return (
<h3>
{t('footer_counter')}
<h3>
);
}
export default SampleComponent;
pages/[locale]/about.js
// file: /pages/[locale]/about.js
import React from 'react';
import Head from 'next/head';
import { useTranslation } from 'next-i18next';
import { getStaticPaths, makeStaticProps } from '../../lib/getStatic';
import SampleComponent from '~/components/MyComponent/SampleComponent.js'
export default function About() {
const { t } = useTranslation('common');
return (
<div>
<Head>
<title>
{ brand.crypto.name }
- Blank page
</title>
</Head>
<p>This is the about page</p>
<p>{t('title')}</p>
<SampleComponent />
</div>
);
}
const getStaticProps = makeStaticProps(['common']);
export { getStaticPaths, getStaticProps };