1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-27 08:21:03 +02:00

Tools: Ignore certain files for translation

This commit is contained in:
Laurent Cozic 2021-12-21 18:10:59 +01:00
parent e08359f7e0
commit 32ffbe7d70
2 changed files with 14 additions and 12 deletions

View File

@ -18,8 +18,7 @@
"buildPluginDoc": "typedoc --name 'Joplin Plugin API Documentation' --mode file -theme './Assets/PluginDocTheme/' --readme './Assets/PluginDocTheme/index.md' --excludeNotExported --excludeExternals --excludePrivate --excludeProtected --out ../joplin-website/docs/api/references/plugin_api packages/lib/services/plugins/api/",
"updateMarkdownDoc": "node ./packages/tools/updateMarkdownDoc",
"buildSettingJsonSchema": "yarn workspace joplin start -- settingschema ../../../joplin-website/docs/schema/settings.json",
"buildTranslations": "yarn run tsc && node packages/tools/build-translation.js",
"buildTranslationsNoTsc": "node packages/tools/build-translation.js",
"buildTranslations": "node packages/tools/build-translation.js",
"buildWebsite": "node ./packages/tools/website/build.js && yarn run buildPluginDoc && yarn run buildSettingJsonSchema",
"circularDependencyCheck": "madge --warning --circular --extensions js ./",
"clean": "npm run clean --workspaces --if-present && node packages/tools/clean && yarn cache clean",

View File

@ -102,6 +102,7 @@ async function createPotFile(potFilePath) {
'./packages/app-cli/tests-build/*',
'./packages/app-cli/tests/*',
'./packages/app-clipper/*',
'./packages/app-desktop/build/*',
'./packages/app-desktop/dist/*',
'./packages/app-desktop/gui/note-viewer/pluginAssets/*',
'./packages/app-desktop/gui/style/*',
@ -116,6 +117,7 @@ async function createPotFile(potFilePath) {
'./packages/lib/rnInjectedJs/*',
'./packages/lib/vendor/*',
'./packages/renderer/assets/*',
'./packages/server/dist/*',
'./packages/tools/*',
'./packages/turndown-plugin-gfm/*',
'./packages/turndown/*',
@ -127,6 +129,11 @@ async function createPotFile(potFilePath) {
process.chdir(rootDir);
let files = (await execCommand(findCommand)).split('\n');
// Further filter files - in particular remove some specific files and
// extensions we don't need. Also, when there's two file with the same
// basename, such as "exmaple.js", and "example.ts", we only keep the file
// with ".ts" extension (since the .js should be the compiled file).
const toProcess = {};
for (const file of files) {
@ -140,6 +147,9 @@ async function createPotFile(potFilePath) {
if (nameNoExt.endsWith('.eslintrc')) continue;
if (nameNoExt.endsWith('jest.config')) continue;
if (nameNoExt.endsWith('jest.setup')) continue;
if (nameNoExt.endsWith('webpack.config')) continue;
if (nameNoExt.endsWith('.prettierrc')) continue;
if (file.endsWith('.d.ts')) continue;
if (toProcess[nameNoExt] && ['ts', 'tsx'].includes(fileExtension(toProcess[nameNoExt]))) {
continue;
@ -155,6 +165,9 @@ async function createPotFile(potFilePath) {
files.sort();
// console.info(files.join('\n'));
// process.exit(0);
// Note: we previously used the xgettext utility, but it only partially
// supports TypeScript and doesn't support .tsx files at all. Besides; the
// TypeScript compiler now converts some `_('some string')` calls to
@ -452,16 +465,6 @@ async function main() {
saveToFile(`${jsonLocalesDir}/index.js`, buildIndex(locales, stats));
// const destDirs = [
// `${libDir}/locales`,
// `${electronDir}/locales`,
// `${cliDir}/locales-build`,
// ];
// for (const destDir of destDirs) {
// await execCommand(`rsync -a "${jsonLocalesDir}/" "${destDir}/"`);
// }
await updateReadmeWithStats(stats);
}