Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5aae6e8336 | ||
|
|
ae18ad45b9 | ||
|
|
0e15bb7e55 | ||
|
|
ff664b9d3b | ||
|
|
da91fb6392 | ||
|
|
f265c7daa6 | ||
|
|
3037e4d8a6 | ||
|
|
b2a7696c0e | ||
|
|
6dc8f64ccb | ||
|
|
0453d7fbaa | ||
|
|
fa6d38f422 | ||
|
|
9f3e945d4e |
@@ -8,6 +8,7 @@ install:
|
||||
- npm install
|
||||
script:
|
||||
- npm run lint
|
||||
- npm run i18n_extract
|
||||
- npm run test
|
||||
- npm run build
|
||||
after_success:
|
||||
|
||||
2
Makefile
2
Makefile
@@ -12,7 +12,7 @@ i18n.concat:
|
||||
# Gathering JSON messages into one file...
|
||||
./src/i18n/i18n-concat.js ./temp/src ./src/i18n/transifex_input.json
|
||||
|
||||
i18n.pre_validate: | i18n.extract i18n.concat
|
||||
detect_changed_source_translations:
|
||||
git diff --exit-code ./src/i18n/transifex_input.json
|
||||
|
||||
tx_url1 = https://www.transifex.com/api/2/project/edx-platform/resource/frontend-component-footer/translation/en/strings/
|
||||
|
||||
10682
package-lock.json
generated
10682
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* This code originally came from https://github.com/efischer19/reactifex/blob/master/main.js,
|
||||
* which should be edx/reactifex. It is temporarily being copied here until we find it a new home.
|
||||
* See the Makefile for how the required hash file is downloaded from Transifex.
|
||||
*/
|
||||
|
||||
// NOTE: This script is called from Jenkins using devDependencies, so eslint is being
|
||||
@@ -23,28 +23,36 @@ function gatherJson(dir) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
// the hash file returns ids whose periods are "escaped" (sort of), like this:
|
||||
// "key": "profile\\.sociallinks\\.social\\.links"
|
||||
// so our regular messageIds won't match them out of the box
|
||||
function escapeDots(messageId) {
|
||||
return messageId.replace(/\./g, '\\.');
|
||||
}
|
||||
|
||||
const jsonDir = process.argv[2];
|
||||
const messageObjects = gatherJson(jsonDir);
|
||||
|
||||
if (process.argv[3] === '--comments') { // prepare to handle the translator notes
|
||||
const thisFile = path.basename(`${__filename}`);
|
||||
const loggingPrefix = path.basename(`${__filename}`); // the name of this JS file
|
||||
const bashScriptsPath = './node_modules/reactifex/bash_scripts';
|
||||
|
||||
process.stdout.write(`${thisFile}: generating bash scripts...\n`);
|
||||
process.stdout.write(`${thisFile}: info file at ${bashScriptsPath}/hashmap.json\n`);
|
||||
const hashFile = `${bashScriptsPath}/hashmap.json`;
|
||||
process.stdout.write(`${loggingPrefix}: reading hash file ${hashFile}\n`);
|
||||
const messageInfo = JSON.parse(fs.readFileSync(hashFile));
|
||||
|
||||
const messageInfo = JSON.parse(fs.readFileSync(`${bashScriptsPath}/hashmap.json`));
|
||||
const dataPath = `${bashScriptsPath}/hashed_data.txt`;
|
||||
|
||||
process.stdout.write(`${thisFile}: data path is ${dataPath}\n`);
|
||||
fs.writeFileSync(dataPath, '');
|
||||
const outputFile = `${bashScriptsPath}/hashed_data.txt`;
|
||||
process.stdout.write(`${loggingPrefix}: writing to output file ${outputFile}\n`);
|
||||
fs.writeFileSync(outputFile, '');
|
||||
|
||||
messageObjects.forEach((message) => {
|
||||
const info = messageInfo.find(mi => mi.key === message.id);
|
||||
const transifexFormatId = escapeDots(message.id);
|
||||
|
||||
const info = messageInfo.find(mi => mi.key === transifexFormatId);
|
||||
if (info) {
|
||||
fs.appendFileSync(dataPath, `${info.string_hash}|${message.description}\n`);
|
||||
fs.appendFileSync(outputFile, `${info.string_hash}|${message.description}\n`);
|
||||
} else {
|
||||
process.stdout.write(`${thisFile}: string ${message.id} does not yet exist on transifex!\n`);
|
||||
process.stdout.write(`${loggingPrefix}: string ${message.id} does not yet exist on transifex!\n`);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -22,8 +22,8 @@ const completeSiteFooterComponent = mockHandleAllTrackEvents =>
|
||||
twitterUrl="https://www.twitter.com"
|
||||
youTubeUrl="https://www.youtube.com"
|
||||
linkedInUrl="https://www.linkedin.com"
|
||||
googlePlusUrl="https://plus.google.com"
|
||||
redditUrl="https://reddit.com"
|
||||
googlePlusUrl="https://plus.google.com"
|
||||
appleAppStoreUrl="https://store.apple.com"
|
||||
googlePlayUrl="https://play.google.com"
|
||||
handleAllTrackEvents={mockHandleAllTrackEvents}
|
||||
@@ -58,8 +58,8 @@ describe('<SiteFooter />', () => {
|
||||
twitterUrl="https://www.twitter.com"
|
||||
youTubeUrl="https://www.youtube.com"
|
||||
linkedInUrl="https://www.linkedin.com"
|
||||
googlePlusUrl="https://plus.google.com"
|
||||
redditUrl="https://reddit.com"
|
||||
googlePlusUrl="https://plus.google.com"
|
||||
appleAppStoreUrl="https://store.apple.com"
|
||||
googlePlayUrl="https://play.google.com"
|
||||
handleAllTrackEvents={jest.fn()}
|
||||
@@ -87,8 +87,8 @@ describe('<SiteFooter />', () => {
|
||||
twitterUrl="https://www.twitter.com"
|
||||
youTubeUrl="https://www.youtube.com"
|
||||
linkedInUrl="https://www.linkedin.com"
|
||||
googlePlusUrl="https://plus.google.com"
|
||||
redditUrl="https://reddit.com"
|
||||
googlePlusUrl="https://plus.google.com"
|
||||
appleAppStoreUrl="https://store.apple.com"
|
||||
googlePlayUrl="https://play.google.com"
|
||||
handleAllTrackEvents={jest.fn()}
|
||||
|
||||
Reference in New Issue
Block a user