global i18n object defined in app.js; smaller translation improvements

This commit is contained in:
Intnick 2017-06-01 17:02:02 +02:00
parent 1a3c20a637
commit addf29f3bc
6 changed files with 24 additions and 33 deletions

View file

@ -137,7 +137,8 @@
"You haven't downloaded anything from LBRY yet. Go": "You haven't downloaded anything from LBRY yet. Go", "You haven't downloaded anything from LBRY yet. Go": "You haven't downloaded anything from LBRY yet. Go",
"search for your first download": "search for your first download", "search for your first download": "search for your first download",
"Loading": "Loading", "Loading": "Loading",
" credits": " credits", "credit": "credit",
"credits": "credits",
"It looks like you haven't published anything to LBRY yet. Go": "It looks like you haven't published anything to LBRY yet. Go", "It looks like you haven't published anything to LBRY yet. Go": "It looks like you haven't published anything to LBRY yet. Go",
"share your beautiful cats with the world": "share your beautiful cats with the world", "share your beautiful cats with the world": "share your beautiful cats with the world",
"report": "report", "report": "report",
@ -198,7 +199,6 @@
"Confirm Purchase": "Confirm Purchase", "Confirm Purchase": "Confirm Purchase",
"This will purchase": "This will purchase", "This will purchase": "This will purchase",
"for": "for", "for": "for",
"credits": "credits",
"Not enough credits": "Not enough credits", "Not enough credits": "Not enough credits",
"You don't have enough LBRY credits to pay for this stream.": "You don't have enough LBRY credits to pay for this stream.", "You don't have enough LBRY credits to pay for this stream.": "You don't have enough LBRY credits to pay for this stream.",
"Download failed": "Download failed", "Download failed": "Download failed",

View file

@ -1,4 +1,5 @@
import store from 'store.js'; import store from 'store.js';
import lbry from './lbry.js';
const env = ENV; const env = ENV;
const config = require(`./config/${env}`); const config = require(`./config/${env}`);
@ -14,5 +15,11 @@ const app = {
} }
} }
const language = lbry.getClientSetting('language') ? lbry.getClientSetting('language') : 'en';
const i18n = require('y18n')({directory: 'app/locales', locale: language});
window.__ = i18n.__;
window.__n = i18n.__n;
window.i18n = i18n;
global.app = app; global.app = app;
module.exports = app; module.exports = app;

View file

@ -20,7 +20,7 @@ class App extends React.Component {
lbry.balanceSubscribe((balance) => { lbry.balanceSubscribe((balance) => {
this.props.updateBalance(balance) this.props.updateBalance(balance)
}) })
}y }
render() { render() {
const { const {

View file

@ -70,7 +70,7 @@ export class CreditAmount extends React.Component {
if (this.props.showFree && parseFloat(formattedAmount) == 0) { if (this.props.showFree && parseFloat(formattedAmount) == 0) {
amountText = __('free'); amountText = __('free');
} else if (this.props.label) { } else if (this.props.label) {
amountText = formattedAmount + (parseFloat(formattedAmount) == 1 ? __(' credit') : __(' credits')); amountText = formattedAmount + ' ' + (parseFloat(formattedAmount) == 1 ? __('credit') : __('credits'));
} else { } else {
amountText = formattedAmount; amountText = formattedAmount;
} }

View file

@ -2,12 +2,6 @@ import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import lbry from './lbry.js'; import lbry from './lbry.js';
import lbryio from './lbryio.js'; import lbryio from './lbryio.js';
const i18n = require('y18n')({directory: 'app/locales'/*, locale: lbry.getClientSetting('language')*/});
window.__ = i18n.__;
window.__n = i18n.__n;
window.i18n = i18n;
import lighthouse from './lighthouse.js'; import lighthouse from './lighthouse.js';
import App from 'component/app/index.js'; import App from 'component/app/index.js';
import SnackBar from 'component/snackBar'; import SnackBar from 'component/snackBar';

View file

@ -38,36 +38,26 @@ export const selectPageTitle = createSelector(
selectCurrentParams, selectCurrentParams,
(page, params) => { (page, params) => {
switch (page) { switch (page) {
case 'settings':
case 'help':
case 'report':
case 'wallet':
case 'send':
case 'receive':
case 'rewards':
case 'start':
case 'publish':
case 'help':
case 'developer':
return __(page.charAt(0).toUpperCase() + page.slice(1))
case 'search': case 'search':
return params.query ? __("Search results for %s", params.query) : __('Search') return params.query ? __("Search results for %s", params.query) : __('Search')
case 'settings':
return __('Settings')
case 'help':
return __('Help')
case 'report':
return __('Report')
case 'wallet':
return __("Wallet")
case 'send':
return __("Send")
case 'receive':
return __("Receive")
case 'rewards':
return __("Rewards")
case 'show': case 'show':
return lbryuri.normalize(params.uri) return lbryuri.normalize(params.uri)
case 'downloaded': case 'downloaded':
return __('Downloads & Purchases') return __('Downloads & Purchases')
case 'published': case 'published':
return __('Publishes') return __('Publishes')
case 'start':
return __('Start')
case 'publish':
return __('Publish')
case 'help':
return __('Help')
case 'developer':
return __('Developer')
case 'discover': case 'discover':
return __('Home') return __('Home')
default: default: