Skip to content

Conversation

muffinresearch
Copy link
Contributor

Fixes mozilla/addons#9642

  • Builds all the locales into separate js files
  • Excludes the bundles if it's not for a relevant app (this was the hardest part) see the ContextReplacementPlugin bit
  • Excludes the bundles being output on the page by the server html since webpack does that bit itself.
  • Webpack automatically loads the localization via jsonp.

} catch (error) {
log.error('Could not load initial redux data');
// eslint-disable-next-line global-require, max-len
require(`bundle?name=[name]-i18n-[folder]!json!../../locale/${locale}/${appName}.json`)((jedData) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to move this into the config but I'm not sure how to do that in a good way at the moment.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 89cec38 on muffinresearch:fix-l10n-bundling into d0680b7 on mozilla:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 89cec38 on muffinresearch:fix-l10n-bundling into d0680b7 on mozilla:master.

@mstriemer
Copy link
Contributor

When I ran npm run build:disco it generated a file disco-i18n-[folder]-964031ce759930910a8a.js which is 23K and seems to include all of the locales. This is the file that was loaded in browser dynamically. It also seems to be loaded with all the locales in npm run dev:disco.

@mstriemer
Copy link
Contributor

Maybe I didn't extract properly?

@mstriemer
Copy link
Contributor

I blew away my node_modules and reinstalled, then it worked.

r+

@muffinresearch muffinresearch merged commit 6e722d1 into mozilla:master May 27, 2016
@muffinresearch muffinresearch deleted the fix-l10n-bundling branch May 27, 2016 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix the bundling of the locales
3 participants