mirror of
https://git.netzspielplatz.de/docker-multiarch/openwrt-firmware-selector.git
synced 2025-11-08 22:09:25 +00:00
Add config system
Introduce ability to change default settings for the app. Currently starting with disabling i18n debug on prod server Signed-off-by: Sudhanshu Gautam <me@sudhanshug.com>
This commit is contained in:
parent
b835f928a4
commit
7ad08e79c9
3 changed files with 14 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
env:
|
env:
|
||||||
browser: true
|
browser: true
|
||||||
|
node: true
|
||||||
es6: true
|
es6: true
|
||||||
jest: true
|
jest: true
|
||||||
extends:
|
extends:
|
||||||
|
|
|
||||||
11
src/config.js
Normal file
11
src/config.js
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
const defaults = {};
|
||||||
|
const prod = {
|
||||||
|
i18nDebug: false,
|
||||||
|
};
|
||||||
|
const dev = {
|
||||||
|
i18nDebug: true,
|
||||||
|
};
|
||||||
|
export default {
|
||||||
|
...defaults,
|
||||||
|
settings: process.env.NODE_ENV === 'development' ? dev : prod,
|
||||||
|
};
|
||||||
|
|
@ -3,6 +3,7 @@ import { initReactI18next } from 'react-i18next';
|
||||||
import LanguageDetector from 'i18next-browser-languagedetector';
|
import LanguageDetector from 'i18next-browser-languagedetector';
|
||||||
import translationEN from './locales/en.json';
|
import translationEN from './locales/en.json';
|
||||||
import translationDE from './locales/de.json';
|
import translationDE from './locales/de.json';
|
||||||
|
import Config from './config';
|
||||||
|
|
||||||
const resources = {
|
const resources = {
|
||||||
en: {
|
en: {
|
||||||
|
|
@ -19,7 +20,7 @@ i18n
|
||||||
.init({
|
.init({
|
||||||
resources,
|
resources,
|
||||||
fallbackLng: 'en',
|
fallbackLng: 'en',
|
||||||
debug: true,
|
debug: Config.settings.i18nDebug,
|
||||||
interpolation: {
|
interpolation: {
|
||||||
escapeValue: false, // not needed for react as it escapes by default
|
escapeValue: false, // not needed for react as it escapes by default
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue