Skip to content
This repository has been archived by the owner on Apr 1, 2019. It is now read-only.

Commit

Permalink
use locale to get the right json file
Browse files Browse the repository at this point in the history
  • Loading branch information
k88hudson committed Jan 12, 2016
1 parent c23f229 commit 20d461c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
7 changes: 3 additions & 4 deletions bin/generate-locale-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ const fs = require("fs");

const LOCALE_DATA_PATH = path.join(__dirname, "../node_modules/react-intl/lib/locale-data");
const MESSAGES_PATH = path.join(__dirname, "../l10n");
const DEFAULT_LOCALE = "en";
const DEFAULT_LOCALE = "en-US";

function generateLocaleData(options) {
function template(options) {
const locale = options.locale;
const messages = options.messages;
const localeData = options.localeData;
Expand All @@ -19,8 +19,7 @@ window.newTabLocaleInfo = {locale: "${locale}", messages: ${JSON.stringify(messa
// This is locale-specific code for react-intl
${localeData}
`;
};

}

function readFileIfExists(filepath) {
try {
Expand Down
4 changes: 2 additions & 2 deletions src/actions/SitesActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ module.exports = {
};
},

getSuggestedDirectory() {
getSuggestedDirectory(locale, channel = "nightly") {
return function next(dispatch) {
dispatch(request(c.REQUEST_SUGGESTED_DIRECTORY));
return fetch(c.SUGGESTED_TILES_URL)
return fetch(`https://tiles.services.mozilla.com/v3/links/fetch/${locale}/${channel}`)
.then(response => response.json())
.then(response => dispatch(receive(c.RECEIVE_SUGGESTED_DIRECTORY, response)));
};
Expand Down
5 changes: 3 additions & 2 deletions src/components/Base/Base.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const React = require("react");
const {connect} = require("react-redux");
const {injectIntl} = require("react-intl");

const Platform = require("lib/platform");
const TileUtils = require("lib/TileUtils");
Expand All @@ -12,7 +13,7 @@ const Settings = require("components/Settings/Settings");
const Base = React.createClass({
componentWillMount: function () {
// this.props.dispatch(actions.getPrefs());
this.props.dispatch(actions.getSuggestedDirectory());
this.props.dispatch(actions.getSuggestedDirectory(this.props.intl.locale));
this.props.dispatch(actions.getCurrentEngine());
this.props.dispatch(actions.getVisibleEngines());
// this.props.dispatch(actions.getFrecentSites());
Expand Down Expand Up @@ -48,4 +49,4 @@ function select(state) {
return state;
}

module.exports = connect(select)(Base);
module.exports = connect(select)(injectIntl(Base));
4 changes: 1 addition & 3 deletions src/lib/constants.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const constants = {
SUGGESTED_TILES_URL: "https://tiles.services.mozilla.com/v3/links/fetch/en-US/nightly"
};
const constants = {};

// Add action names
[
Expand Down

0 comments on commit 20d461c

Please sign in to comment.