From 09dd68fed78cea65d5209e08313d52264d72550a Mon Sep 17 00:00:00 2001 From: Azurnex <32654584+z3ro0k@users.noreply.github.com> Date: Mon, 28 Mar 2022 00:46:36 -0600 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=8C=B8=20Spanish=20translation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/locales/es/translation.json | 58 ++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 public/locales/es/translation.json diff --git a/public/locales/es/translation.json b/public/locales/es/translation.json new file mode 100644 index 0000000..e976063 --- /dev/null +++ b/public/locales/es/translation.json @@ -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 y conviértete en colaborador!" +} From 8dd1a0927ad112c01e44473be9a8365da855da79 Mon Sep 17 00:00:00 2001 From: Yasuaki Uechi Date: Mon, 28 Mar 2022 16:28:47 +0900 Subject: [PATCH 2/2] fix: enable spanish translation --- CONTRIBUTING.md | 47 ++++++++++++++++++++++++++++++++++++--- src/components/Footer.tsx | 3 +++ src/util/i18n.ts | 3 ++- 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 49cc240..9e16868 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -98,15 +98,16 @@ For example, `` 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 ( + + {t('language')} + + + ); +}; +``` diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index 58873a0..35800d9 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -46,6 +46,9 @@ const Languages = () => {
  • Português-BR
  • +
  • + Español +
  • ); diff --git a/src/util/i18n.ts b/src/util/i18n.ts index 9255cb4..3822ba2 100644 --- a/src/util/i18n.ts +++ b/src/util/i18n.ts @@ -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, }, }, ],