Include y18n without creating files + fix modal

This commit is contained in:
Mayesters 2017-06-03 13:27:37 +02:00
parent 4e86023bf1
commit a539b58829
2 changed files with 8 additions and 6 deletions

View file

@ -3,7 +3,8 @@ import lbry from './lbry.js';
const env = ENV; const env = ENV;
const config = require(`./config/${env}`); const config = require(`./config/${env}`);
const i18n = require('y18n') const language = lbry.getClientSetting('language') ? lbry.getClientSetting('language') : 'en';
const i18n = require('y18n')({directory: 'app/locales', updateFiles: false, locale: language});
const logs = []; const logs = [];
const app = { const app = {
env: env, env: env,

View file

@ -1,6 +1,7 @@
import React from 'react'; import React from 'react';
import ReactModal from 'react-modal'; import ReactModal from 'react-modal';
import Link from 'component/link'; import Link from 'component/link';
import app from '../app.js'
export class Modal extends React.Component { export class Modal extends React.Component {
static propTypes = { static propTypes = {
@ -17,8 +18,8 @@ export class Modal extends React.Component {
static defaultProps = { static defaultProps = {
type: 'alert', type: 'alert',
overlay: true, overlay: true,
confirmButtonLabel: __('OK'), confirmButtonLabel: app.i18n.__('OK'),
abortButtonLabel: __('Cancel'), abortButtonLabel: app.i18n.__('Cancel'),
confirmButtonDisabled: false, confirmButtonDisabled: false,
abortButtonDisabled: false, abortButtonDisabled: false,
} }
@ -51,9 +52,9 @@ export class ExpandableModal extends React.Component {
} }
static defaultProps = { static defaultProps = {
confirmButtonLabel: __('OK'), confirmButtonLabel: app.i18n.__('OK'),
expandButtonLabel: __('Show More...'), expandButtonLabel: app.i18n.__('Show More...'),
hideButtonLabel: __('Show Less'), hideButtonLabel: app.i18n.__('Show Less'),
} }
constructor(props) { constructor(props) {