From 41d3cce977858ca5062cd7486ccbebf828f7dbf8 Mon Sep 17 00:00:00 2001 From: Clement G Date: Sat, 18 Apr 2020 19:12:23 +0200 Subject: [PATCH] feat(Paypal): revert change local system (wip) #31 --- i18n.config.js | 2 +- public/locale/i18n/{en_GB => en}/common.json | 0 public/locale/i18n/{en_GB => en}/locale.json | 0 public/locale/i18n/{en_GB => en}/resource.json | 0 public/locale/i18n/{es_ES => es}/common.json | 0 public/locale/i18n/{es_ES => es}/locale.json | 0 public/locale/i18n/{es_ES => es}/resource.json | 0 public/locale/i18n/{fr_FR => fr}/common.json | 0 public/locale/i18n/{fr_FR => fr}/locale.json | 0 public/locale/i18n/{fr_FR => fr}/resource.json | 0 src/components/banner/Paypal.jsx | 12 +++++++++--- src/components/layouts/Footer.jsx | 8 +++----- src/i18n.jsx | 4 ++-- 13 files changed, 15 insertions(+), 11 deletions(-) rename public/locale/i18n/{en_GB => en}/common.json (100%) rename public/locale/i18n/{en_GB => en}/locale.json (100%) rename public/locale/i18n/{en_GB => en}/resource.json (100%) rename public/locale/i18n/{es_ES => es}/common.json (100%) rename public/locale/i18n/{es_ES => es}/locale.json (100%) rename public/locale/i18n/{es_ES => es}/resource.json (100%) rename public/locale/i18n/{fr_FR => fr}/common.json (100%) rename public/locale/i18n/{fr_FR => fr}/locale.json (100%) rename public/locale/i18n/{fr_FR => fr}/resource.json (100%) diff --git a/i18n.config.js b/i18n.config.js index 23c2c61..efcbe45 100644 --- a/i18n.config.js +++ b/i18n.config.js @@ -30,7 +30,7 @@ module.exports = { // Check out https://github.com/acornjs/acorn/tree/master/acorn#interface for additional options } }, - lngs: ["en_GB", "fr_FR", "es_ES"], + lngs: ["en", "fr", "es"], ns: ["resource", "common"], defaultLng: "en", defaultNs: "resource", diff --git a/public/locale/i18n/en_GB/common.json b/public/locale/i18n/en/common.json similarity index 100% rename from public/locale/i18n/en_GB/common.json rename to public/locale/i18n/en/common.json diff --git a/public/locale/i18n/en_GB/locale.json b/public/locale/i18n/en/locale.json similarity index 100% rename from public/locale/i18n/en_GB/locale.json rename to public/locale/i18n/en/locale.json diff --git a/public/locale/i18n/en_GB/resource.json b/public/locale/i18n/en/resource.json similarity index 100% rename from public/locale/i18n/en_GB/resource.json rename to public/locale/i18n/en/resource.json diff --git a/public/locale/i18n/es_ES/common.json b/public/locale/i18n/es/common.json similarity index 100% rename from public/locale/i18n/es_ES/common.json rename to public/locale/i18n/es/common.json diff --git a/public/locale/i18n/es_ES/locale.json b/public/locale/i18n/es/locale.json similarity index 100% rename from public/locale/i18n/es_ES/locale.json rename to public/locale/i18n/es/locale.json diff --git a/public/locale/i18n/es_ES/resource.json b/public/locale/i18n/es/resource.json similarity index 100% rename from public/locale/i18n/es_ES/resource.json rename to public/locale/i18n/es/resource.json diff --git a/public/locale/i18n/fr_FR/common.json b/public/locale/i18n/fr/common.json similarity index 100% rename from public/locale/i18n/fr_FR/common.json rename to public/locale/i18n/fr/common.json diff --git a/public/locale/i18n/fr_FR/locale.json b/public/locale/i18n/fr/locale.json similarity index 100% rename from public/locale/i18n/fr_FR/locale.json rename to public/locale/i18n/fr/locale.json diff --git a/public/locale/i18n/fr_FR/resource.json b/public/locale/i18n/fr/resource.json similarity index 100% rename from public/locale/i18n/fr_FR/resource.json rename to public/locale/i18n/fr/resource.json diff --git a/src/components/banner/Paypal.jsx b/src/components/banner/Paypal.jsx index e116302..14e82fa 100644 --- a/src/components/banner/Paypal.jsx +++ b/src/components/banner/Paypal.jsx @@ -4,17 +4,23 @@ import i18n from '../../i18n' const Paypal = (props) => { - const localeStringShort=i18n.language.substring(0,2); - const localeStringComplete=localeStringShort.toLowerCase()+"_"+localeStringShort.toUpperCase(); + let localeStringShort=i18n.language.substring(0,2); + let localeStringComplete=localeStringShort.toLowerCase()+"_"+localeStringShort.toUpperCase(); + if(localeStringComplete==="en_EN"){ + localeStringComplete="en_US"; + localeStringShort="FR"; + } const imageLink="https://www.paypalobjects.com/"+localeStringComplete+"/"+localeStringShort.toUpperCase()+"/i/btn/btn_donateCC_LG.gif"; const pixelLink="https://www.paypal.com/"+localeStringComplete+"/i/scr/pixel.gif"; + return ( +
-
); +
); }; diff --git a/src/components/layouts/Footer.jsx b/src/components/layouts/Footer.jsx index aaf5657..b565531 100644 --- a/src/components/layouts/Footer.jsx +++ b/src/components/layouts/Footer.jsx @@ -4,7 +4,6 @@ import { Link } from "react-router-dom"; import { FlagIcon } from '../flag' import i18n from '../../i18n' -import Helloasso from "../banner/Helloasso"; import Paypal from "../banner/Paypal"; class Footer extends Component { @@ -29,19 +28,18 @@ class Footer extends Component { - {t("Who are we")} - - {" "} - {" "} -
-
diff --git a/src/i18n.jsx b/src/i18n.jsx index c174260..3d49bbc 100644 --- a/src/i18n.jsx +++ b/src/i18n.jsx @@ -3,13 +3,13 @@ import XHR from 'i18next-xhr-backend'; import LanguageDetector from 'i18next-browser-languagedetector'; import { initReactI18next } from 'react-i18next'; -console.log("locale="+navigator.language); + i18n .use(XHR) .use(LanguageDetector) .use(initReactI18next) // bind react-i18next to the instance .init({ - fallbackLng: 'en_GB', + fallbackLng: 'en', debug: true, saveMissing: true, // send not translated keys to endpoint