Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2658 from matrix-org/bwindels/moarcachebustin
Browse files Browse the repository at this point in the history
Cache-bust languages.json with file-loader
  • Loading branch information
bwindels authored Feb 20, 2019
2 parents 338eafa + 44bedb2 commit 6455334
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ module.exports = {
"flowtype",
"babel"
],
globals: {
LANGUAGES_FILE: "readonly",
},
env: {
es6: true,
},
Expand Down
2 changes: 1 addition & 1 deletion scripts/travis/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ ln -s "$REACT_SDK_DIR/node_modules/matrix-js-sdk" node_modules/matrix-js-sdk
rm -r node_modules/matrix-react-sdk
ln -s "$REACT_SDK_DIR" node_modules/matrix-react-sdk

npm run build
RIOT_LANGUAGES_FILE="../riot-web/webapp/i18n/languages.json" npm run build
popd
4 changes: 3 additions & 1 deletion src/languageHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,10 @@ export function getCurrentLanguage() {

function getLangsJson() {
return new Promise((resolve, reject) => {
// LANGUAGES_FILE is a webpack compile-time define, see webpack config
const url = (typeof LANGUAGES_FILE === "string") ? require(LANGUAGES_FILE) : (i18nFolder + 'languages.json');
request(
{ method: "GET", url: i18nFolder + 'languages.json' },
{ method: "GET", url },
(err, response, body) => {
if (err || response.status < 200 || response.status >= 300) {
reject({err: err, response: response});
Expand Down

0 comments on commit 6455334

Please sign in to comment.