mirror of
https://github.com/uetchy/namae.git
synced 2025-07-01 22:10:04 +09:00
commit
1a5c3274a4
@ -98,15 +98,16 @@ For example, `<DedicatedAvailability service="<service>" />` will send a request
|
||||
|
||||
## Adding a new language
|
||||
|
||||
Suppose we'll add a support for Esperanto.
|
||||
Suppose we'll add a support for Esperanto. First, copy `public/locales/en` folder and rename to `public/locales/eo` which is a language code for Esperanto.
|
||||
|
||||
```bash
|
||||
cd public/locales
|
||||
cp -r en eo
|
||||
# edit eo/translation.json
|
||||
```
|
||||
|
||||
then edit `src/util/i18n.ts`:
|
||||
Then translate `eo/translation.json`.
|
||||
|
||||
After that, edit `src/util/i18n.ts`:
|
||||
|
||||
```patch
|
||||
- const TRANSLATION_VERSION = '2';
|
||||
@ -138,3 +139,43 @@ i18n
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
and `src/components/Footer.tsx`:
|
||||
|
||||
```patch
|
||||
const Languages = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<Pane>
|
||||
<Title>{t('language')}</Title>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/?lng=en">English</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/?lng=de">Deutsch</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/?lng=fr">Français</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/?lng=ja">日本語</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/?lng=zh-Hans">简体中文</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/?lng=zh-Hant">繁體中文</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/?lng=pt-BR">Português-BR</a>
|
||||
</li>
|
||||
+ <li>
|
||||
+ <a href="/?lng=eo">Esperanto</a>
|
||||
+ </li>
|
||||
</ul>
|
||||
</Pane>
|
||||
);
|
||||
};
|
||||
```
|
||||
|
58
public/locales/es/translation.json
Normal file
58
public/locales/es/translation.json
Normal file
@ -0,0 +1,58 @@
|
||||
{
|
||||
"about": "Acerca de",
|
||||
"available": "Disponible",
|
||||
"blog": "Artículo de blog",
|
||||
"community": "Comunidad",
|
||||
"contributors": "Colaboradores",
|
||||
"countryCode": "mx",
|
||||
"description": "Verifique la disponibilidad de sus nuevas ideas de nombres de aplicaciones en los principales registros a la vez.",
|
||||
"gettingStarted": "Empezando",
|
||||
"gettingStartedWithExample": "Prueba con namae",
|
||||
"issues": "Issues",
|
||||
"language": "Idioma",
|
||||
"noResult": "Sin resultados",
|
||||
"placeholder": "búsqueda",
|
||||
"pressEnterToSearch": "Presiona Enter para buscar",
|
||||
"providers": {
|
||||
"appStore": "App Store",
|
||||
"archlinux": "Arch Linux",
|
||||
"ubuntu": "Ubuntu",
|
||||
"debian": "Debian",
|
||||
"domains": "Domains",
|
||||
"firebase": "Firebase",
|
||||
"github": "Organización de GitHub",
|
||||
"githubSearch": "Repositorio de GitHub",
|
||||
"gitlab": "GitLab",
|
||||
"google": "Google Search",
|
||||
"heroku": "Heroku",
|
||||
"homebrew": "Homebrew",
|
||||
"instagram": "Instagram",
|
||||
"jsorg": "js.org",
|
||||
"linux": "Linux",
|
||||
"netlify": "Netlify",
|
||||
"now": "Vercel",
|
||||
"npm": "npm",
|
||||
"nta": "Company (JP)",
|
||||
"ocaml": "OCaml",
|
||||
"playStore": "Google Play Store",
|
||||
"pypi": "PyPI",
|
||||
"rubygems": "RubyGems",
|
||||
"rust": "Rust",
|
||||
"s3": "AWS S3",
|
||||
"slack": "Slack",
|
||||
"spectrum": "Spectrum",
|
||||
"reddit": "Reddit",
|
||||
"twitter": "Twitter"
|
||||
},
|
||||
"showMore": "mostrar más",
|
||||
"title": "Escoge un nombre ingenioso para su nueva aplicación",
|
||||
"try": "¿Qué tal esto?",
|
||||
"unavailable": "Sin disponibilidad",
|
||||
"uniqueness": {
|
||||
"description": "UNIQ muestra cuán único es el nombre (0 a 100)",
|
||||
"high": "Bastante único",
|
||||
"low": "Típico",
|
||||
"moderate": "Moderadamente único"
|
||||
},
|
||||
"join-us": "¡Envía <1>una pull request</1> y conviértete en colaborador!"
|
||||
}
|
@ -46,6 +46,9 @@ const Languages = () => {
|
||||
<li>
|
||||
<a href="/?lng=pt-BR">Português-BR</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/?lng=es">Español</a>
|
||||
</li>
|
||||
</ul>
|
||||
</Pane>
|
||||
);
|
||||
|
@ -5,7 +5,7 @@ import XHR from 'i18next-xhr-backend';
|
||||
import LanguageDetector from 'i18next-browser-languagedetector';
|
||||
import { initReactI18next } from 'react-i18next';
|
||||
|
||||
const TRANSLATION_VERSION = '7';
|
||||
const TRANSLATION_VERSION = '8';
|
||||
|
||||
i18n
|
||||
.use(Backend)
|
||||
@ -24,6 +24,7 @@ i18n
|
||||
'zh-Hans': TRANSLATION_VERSION,
|
||||
'zh-Hant': TRANSLATION_VERSION,
|
||||
'pt-BR': TRANSLATION_VERSION,
|
||||
es: TRANSLATION_VERSION,
|
||||
},
|
||||
},
|
||||
],
|
||||
|
Loading…
x
Reference in New Issue
Block a user