This commit is contained in:
SachaG 2018-05-10 09:38:25 +09:00
parent 00b2a159c1
commit e2cba32b15
6 changed files with 9 additions and 6 deletions

View file

@ -1,7 +1,7 @@
import { Components, registerComponent, getSetting, Strings, runCallbacks } from 'meteor/vulcan:lib';
import { Components, registerComponent, getSetting, Strings, runCallbacks, detectLocale } from 'meteor/vulcan:lib';
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { IntlProvider, intlShape, detectLocale } from 'meteor/vulcan:i18n';
import { IntlProvider, intlShape } from 'meteor/vulcan:i18n';
import withCurrentUser from '../containers/withCurrentUser.js';
class App extends PureComponent {

View file

@ -4,5 +4,4 @@ registerSetting('locale', 'en', 'Your app\'s locale (“en”, “fr”, etc.)')
export { default as FormattedMessage } from './message.js';
export { intlShape } from './shape.js';
export * from './detect.js';
export { default as IntlProvider } from './provider.js';

View file

@ -1,3 +1,8 @@
/*
Helper to detect current browser locale
*/
export const detectLocale = () => {
var lang

View file

@ -28,4 +28,5 @@ export * from './debug.js';
export * from './startup.js';
export * from './errors.js';
export * from './intl.js';
export * from './detect_locale.js';
// export * from './resolvers.js';

View file

@ -111,8 +111,6 @@ function sendSSRHtml(options, req, res, next, renderProps) {
req.dynamicBody += `<${options.rootElementType || 'div'} id="${options.rootElement || 'react-app'}"${rootElementAttributes}>${html || ''}</${options.rootElementType || 'div'}>`;
console.log(req.headers['accept-language'])
if (typeof options.htmlHook === 'function') {
const { dynamicHead, dynamicBody } = options.htmlHook(req, res, req.dynamicHead, req.dynamicBody);
req.dynamicHead = dynamicHead;