Comparing version
@@ -16,14 +16,22 @@ /* eslint-disable no-console */ | ||
.then((fileNames) => { | ||
return Promise.all([ | ||
sourceProcessing.readTokensFromSourceCode( | ||
parseArguments.patterns(), | ||
fileNames, | ||
parseArguments.ignore() | ||
), | ||
sourceProcessing.readTokensFromI18n( | ||
parseArguments.destinationPattern(), | ||
parseArguments.destinationFile(), | ||
parseArguments.ignore() | ||
) | ||
]); | ||
return sourceProcessing.readTokenFromI18nIgnore().then((tokensI18nIgnore) => { | ||
let tokensToIgnore, tokensArgsIgnore; | ||
tokensArgsIgnore = parseArguments.ignore(); | ||
if (tokensI18nIgnore && tokensI18nIgnore.length === 0) { | ||
tokensToIgnore = tokensArgsIgnore; | ||
} else { | ||
tokensToIgnore = [...tokensI18nIgnore, ...tokensArgsIgnore]; | ||
} | ||
return Promise.all([ | ||
sourceProcessing.readTokensFromSourceCode(parseArguments.patterns(), fileNames, tokensToIgnore), | ||
sourceProcessing.readTokensFromI18n( | ||
parseArguments.destinationPattern(), | ||
parseArguments.destinationFile(), | ||
tokensToIgnore | ||
) | ||
]); | ||
}); | ||
}) | ||
@@ -30,0 +38,0 @@ .then((tokens) => destinationProcessing.generateTokensFromSourceCode(tokens[0], tokens[1])); |
@@ -9,2 +9,4 @@ "use strict"; | ||
exports.I18IGNORE = ".i18nignore"; | ||
exports.COMMANDS = { | ||
@@ -11,0 +13,0 @@ CHECK: "check", |
@@ -70,1 +70,12 @@ "use strict"; | ||
}; | ||
exports.readTokenFromI18nIgnore = function () { | ||
return fs | ||
.readFile(CONST.I18IGNORE) | ||
.then((buffer) => { | ||
return buffer.toString().split("\n"); | ||
}) | ||
.catch(() => { | ||
return []; | ||
}); | ||
}; |
{ | ||
"name": "i18n-ui5", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "Simplify work with translations in OpenUI5 or SAPUI5 framework. The plugin searches views and source code of project in OpenUI5 or SAPUI5 framework for translation tokens and automatically update translation file used by the framework.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,6 +8,6 @@ # i18n-ui5 | ||
* \_\_("MSGID") | ||
* getText("MSGID") | ||
* "{i18n>MSGID}" | ||
* "{@i18n>MSGID}" | ||
- \_\_("MSGID") | ||
- getText("MSGID") | ||
- "{i18n>MSGID}" | ||
- "{@i18n>MSGID}" | ||
@@ -28,3 +28,2 @@ Then activate/deactivate/add messages in/to `i18n.properties` | ||
``` | ||
@@ -36,3 +35,2 @@ npx i18n-ui5 --check | ||
``` | ||
@@ -42,6 +40,4 @@ npx i18n-ui5 --replace | ||
Use different destination file | ||
``` | ||
@@ -53,5 +49,12 @@ npx i18n-ui5 --replace --destination i18n.properties | ||
``` | ||
npx i18n-ui5 --ignore SEMANTIC_CONTROL_SAVE_AS_TILE --ignore SEMANTIC_CONTROL_SAVE | ||
``` | ||
To ignroe more i18n tokens create `.i18nignore` file in root of your project and add tokens | ||
to the file. | ||
``` | ||
npx i18n-ui5 --ignore SEMANTIC_CONTROL_SAVE_AS_TILE --ignore SEMANTIC_CONTROL_SAVE_AS_TILE | ||
SEMANTIC_CONTROL_SAVE_AS_TILE | ||
SEMANTIC_CONTROL_SAVE | ||
``` |
25895
3.39%417
3.99%56
5.66%