mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 10:25:08 +01:00
better error messages
This commit is contained in:
parent
0a45f12ba7
commit
ff5355f0ee
@ -76,11 +76,14 @@ let AccordionListItemTableToggle = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
let messageShow = this.props.numOfTableItems == 1 ?
|
||||||
|
getLangText('Show the edition') :
|
||||||
|
getLangText('Show all %d Editions', this.props.numOfTableItems)
|
||||||
return (
|
return (
|
||||||
<span
|
<span
|
||||||
className={this.props.className}
|
className={this.props.className}
|
||||||
onClick={this.props.onClick}>
|
onClick={this.props.onClick}>
|
||||||
{this.props.show ? getLangText('Hide all %d Editions', this.props.numOfTableItems) : getLangText('Show all %d Editions', this.props.numOfTableItems)}
|
{this.props.show ? getLangText('Hide') : messageShow}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,8 @@ const languages = {
|
|||||||
'en-US': {
|
'en-US': {
|
||||||
'Bitcoin Address': 'Bitcoin Address',
|
'Bitcoin Address': 'Bitcoin Address',
|
||||||
'Actions': 'Actions',
|
'Actions': 'Actions',
|
||||||
'Hide all %d Editions': 'Hide all %d Editions',
|
'Hide': 'Hide',
|
||||||
|
'Show the edition': 'Show the edition',
|
||||||
'Show all %d Editions': 'Show all %d Editions',
|
'Show all %d Editions': 'Show all %d Editions',
|
||||||
'by %s': 'by %s',
|
'by %s': 'by %s',
|
||||||
'Account Settings': 'Account Settings',
|
'Account Settings': 'Account Settings',
|
||||||
@ -15,8 +16,9 @@ const languages = {
|
|||||||
'de': {
|
'de': {
|
||||||
'Bitcoin Address': 'Bitcoin Adresse',
|
'Bitcoin Address': 'Bitcoin Adresse',
|
||||||
'Actions': 'Aktionen',
|
'Actions': 'Aktionen',
|
||||||
'Hide all %d Editions': 'Zeige all %d Editionen an',
|
'Hide': 'Verstecke',
|
||||||
'Show all %d Editions': 'Verstecke alle %d Editionen',
|
'Show the edition': 'Zeige die Edition',
|
||||||
|
'Show all %d Editions': 'Zeige alle %d Editionen an',
|
||||||
'by %s': 'von %s',
|
'by %s': 'von %s',
|
||||||
'Account Settings': 'Kontoeinstellungen',
|
'Account Settings': 'Kontoeinstellungen',
|
||||||
'FAQ': 'Fragen & Antworten',
|
'FAQ': 'Fragen & Antworten',
|
||||||
|
@ -11,7 +11,7 @@ import { formatText } from './general_utils';
|
|||||||
export function getLangText(s, ...args) {
|
export function getLangText(s, ...args) {
|
||||||
let lang = navigator.language || navigator.userLanguage;
|
let lang = navigator.language || navigator.userLanguage;
|
||||||
// this is just for testing, as changing the navigator.language wasn't possible
|
// this is just for testing, as changing the navigator.language wasn't possible
|
||||||
//lang = 'de';
|
lang = 'de';
|
||||||
try {
|
try {
|
||||||
if(lang in languages) {
|
if(lang in languages) {
|
||||||
return formatText(languages[lang][s], args);
|
return formatText(languages[lang][s], args);
|
||||||
@ -21,7 +21,7 @@ export function getLangText(s, ...args) {
|
|||||||
}
|
}
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
if(!(s in languages[lang])) {
|
if(!(s in languages[lang])) {
|
||||||
console.error(new Error('Language-string is not in constants file for string: ' + s));
|
console.error(new Error('Language-string is not in constants file. Add: "' + s + '" to the "' + lang + '" language file.'));
|
||||||
} else {
|
} else {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user