i18n string dictionaries (#3532)

* TabBar & Settings -> Views i18n enabled

* Proxy i18n

* Settings i18n

* defaultLocale

* Introduce thin Translate wrapper

* PropTypes util caters for multiples

* Translate & LanguageSelector under ui

* Update location & proptypes

* Add UI Language selector

* German settings pages

* Add German language selection

* Corrected umlaut encoding

* Lint

* Re-apply pre-merge conflict changes

* better German i18n

* Language names in locale language

* i8n -> index

* Allow for development/production operation

* Use Yahoo react-intl (as opposed to react-i18nify)

* Use default messages wih expansions

* Remove non-reused variable definitions

* Use FormattedMessage directly, opens up WebPack & Babel opportunities

* Add flat to flatten

* Extract default messages via babel

* Webpack to aggegrate i18n defaultMessage

* Re-add react-intl after merge

* Update proptype references (merge)

* Strip down external dictionary

* i18n for dapps

* Restore tests submodule

* Allow language changes to reflect

* Style updates
This commit is contained in:
Jaco Greeff
2016-12-11 17:42:35 +01:00
committed by GitHub
parent 839e3385dd
commit 885d6eaa4d
24 changed files with 783 additions and 196 deletions

21
js/src/i18n/de/index.js Normal file
View File

@@ -0,0 +1,21 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import settings from './settings';
export default {
settings
};

View File

@@ -0,0 +1,96 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
export default {
label: 'Einstellungen',
background: {
label: 'Hintergrund',
overview_0: 'Dein Hintergrundmuster ist einzigartig und beruht auf deiner Parity-Installation. Es ändert sich immer dann, wenn du ein neues Signer-Token erstellst. So können dezentrale Applicationen keine Vertrauenswürdigkeit vortäuschen.',
overview_1: 'Such dir ein Muster aus und merke es dir. Dieses Muster wird dir von nun an immer angezeigt, es sei denn du löschst deinen Browser-Cache oder benutzt ein neues Signer-Token.',
button_more: 'weitere generieren'
},
parity: {
label: 'Parity',
overview_0: 'Diese Einstellungen verändern das Verhalten deines Parity-Knotens.',
languages: {
label: 'Anzeigesprache',
hint: 'Die Sprache, in der dir diese Obefläche angezeigt wird'
},
modes: {
label: 'Betriebsmodus',
hint: 'Der Synchronisations-Modus deines Parity-Knotens',
mode_active: 'Parity synchronisiert kontinuierlich die Blockchain',
mode_passive: 'Parity synchronisiert zu Beginn, schläft dann und wacht regelmäßig zum Synchronisieren auf',
mode_dark: 'Parity synchronisiert nur falls erforderlich, etwa wenn es aus der Ferne aufgerufen wird',
mode_offline: 'Parity synchronisiert nicht'
}
},
proxy: {
label: 'Proxy',
overview_0: 'Die Proxy-Einstellungen ermöglichen dir einen einfachen Zugriff über einprägsame Adressen, auf die Oberfläche mit all ihren dezentralen Anwendungen.',
details_0: 'Anstelle des Zugriffs über IP-Adresse und Port wirst du über die .parity-Subdomain auf die Parity-Oberfläche zugreifen können, indem du {homeProxy} besuchst. Dafür musst du folgenden Eintrag in den Proxy-Einstellungen deines Browsers hinzufügen:',
details_1: 'Hier findest du Anleitungen zum Anpassen der Proxy-Einstellungen in {windowsLink}, {macOSLink} oder {ubuntuLink}.'
},
views: {
label: 'Ansicht',
overview_0: 'Hier kannst du entscheiden, welche Teile der Parity-Oberfläche dir angezeigt werden sollen.',
overview_1: 'Benutzt du Parity ganz normal? Die Standardeinstellungen sind gleichermaßen für Einsteigende als auch für Fortgeschrittene gedacht.',
overview_2: 'Entwickelst du mit Parity? Füge zum Beispiel den Reiter "Contracts" zu deiner Ansicht hinzu.',
overview_3: 'Bist du Miner oder betreibst du einen großen Knoten? Füge den Reiter "Status" hinzu, um alle Information über den Betrieb deines Knotens im Blick zu halten.',
accounts: {
label: 'Konten',
description: 'Eine Liste aller Konten, die mit dieser Parity-Installation verbunden sind. Sende Transaktionen, empfange eingehende Beträge, verwalte deine Kontostände oder lade deine Konten auf.'
},
addresses: {
label: 'Adressbuch',
description: 'Eine Liste all deiner Kontakte und der Adressen, die von dieser Parity-Installation verwaltet werden. Überwache Konten und gelange mit nur einem Klick zu Details deiner Transaktionen.'
},
apps: {
label: 'Anwendungen',
description: 'Dezentrale Anwendungen, die mit dem Netzwerk interagieren. Füge Anwendungen hinzu, entferne oder öffne Anwendungen.'
},
contracts: {
label: 'Contracts',
description: 'Interagiere mit Smart Contracts im Netzwerk. Diese Umgebung ist auf Fortgeschrittene mit gutem Verständnis der Fuktionsweise von Smart Contracts zugeschnitten.'
},
status: {
label: 'Status',
description: 'Schau dir an, wie sich dein Parity-Knoten schlägt. Hier findest du zum Beispiel die Anzahl der aktuellen Verbindungen zum Netzwerk, Logs deiner laufenden Instanz und (sofern konfiguriert) Details zum Mining.'
},
signer: {
label: 'Signer',
description: 'In diesem sicheren Bereich kannst du Transaktionen, die von dir oder von dezentralen Anwendungen erstellt wurden, prüfen und dann genehmigen oder ablehnen.'
},
settings: {
label: 'Einstellungen',
description: 'Diese Seite. Pass die Parity-Oberfläche nach deinen Wünschen an.'
}
}
};

21
js/src/i18n/en/index.js Normal file
View File

@@ -0,0 +1,21 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import settings from './settings';
export default {
settings
};

View File

@@ -0,0 +1,63 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
export default {
label: 'settings',
background: {
label: 'background'
},
parity: {
label: 'parity'
},
proxy: {
label: 'proxy'
},
views: {
label: 'views',
accounts: {
label: 'Accounts'
},
addresses: {
label: 'Addressbook'
},
apps: {
label: 'Applications'
},
contracts: {
label: 'Contracts'
},
status: {
label: 'Status'
},
signer: {
label: 'Signer'
},
settings: {
label: 'Settings'
}
}
};

21
js/src/i18n/index.js Normal file
View File

@@ -0,0 +1,21 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import LocaleStore from './store';
export {
LocaleStore
};

20
js/src/i18n/languages.js Normal file
View File

@@ -0,0 +1,20 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
export default {
de: 'Deutsch',
en: 'English'
};

62
js/src/i18n/store.js Normal file
View File

@@ -0,0 +1,62 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import flatten from 'flat';
import { action, observable, transaction } from 'mobx';
import { addLocaleData } from 'react-intl';
import de from 'react-intl/locale-data/de';
import en from 'react-intl/locale-data/en';
import languages from './languages';
import deMessages from './de';
import enMessages from './en';
let instance = null;
const isProduction = process.env.NODE_ENV === 'production';
const DEFAULT = 'en';
const LANGUAGES = flatten({ languages });
const MESSAGES = {
de: Object.assign(flatten(deMessages), LANGUAGES),
en: Object.assign(flatten(enMessages), LANGUAGES)
};
const LOCALES = isProduction
? ['en']
: ['en', 'de'];
addLocaleData([...de, ...en]);
export default class Store {
@observable locale = DEFAULT;
@observable locales = LOCALES;
@observable messages = MESSAGES[DEFAULT];
@observable isDevelopment = !isProduction;
@action setLocale (locale) {
transaction(() => {
this.locale = locale;
this.messages = MESSAGES[locale];
});
}
static get () {
if (!instance) {
instance = new Store();
}
return instance;
}
}