better error messages

This commit is contained in:
Tim Daubenschütz 2015-06-02 14:43:42 +02:00
parent 0a45f12ba7
commit ff5355f0ee
3 changed files with 11 additions and 6 deletions

View File

@ -76,11 +76,14 @@ let AccordionListItemTableToggle = React.createClass({
},
render() {
let messageShow = this.props.numOfTableItems == 1 ?
getLangText('Show the edition') :
getLangText('Show all %d Editions', this.props.numOfTableItems)
return (
<span
className={this.props.className}
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>
);
}

View File

@ -2,7 +2,8 @@ const languages = {
'en-US': {
'Bitcoin Address': 'Bitcoin Address',
'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',
'by %s': 'by %s',
'Account Settings': 'Account Settings',
@ -15,8 +16,9 @@ const languages = {
'de': {
'Bitcoin Address': 'Bitcoin Adresse',
'Actions': 'Aktionen',
'Hide all %d Editions': 'Zeige all %d Editionen an',
'Show all %d Editions': 'Verstecke alle %d Editionen',
'Hide': 'Verstecke',
'Show the edition': 'Zeige die Edition',
'Show all %d Editions': 'Zeige alle %d Editionen an',
'by %s': 'von %s',
'Account Settings': 'Kontoeinstellungen',
'FAQ': 'Fragen & Antworten',

View File

@ -11,7 +11,7 @@ import { formatText } from './general_utils';
export function getLangText(s, ...args) {
let lang = navigator.language || navigator.userLanguage;
// this is just for testing, as changing the navigator.language wasn't possible
//lang = 'de';
lang = 'de';
try {
if(lang in languages) {
return formatText(languages[lang][s], args);
@ -21,7 +21,7 @@ export function getLangText(s, ...args) {
}
} catch(err) {
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 {
console.error(err);
}