Locales collector from js sources.
localer [...glob patterns to js source] [--strings to show code frames only for strings] [--html to generate html] [--summary to show list of added and unused locales] [--compare [...glob patterns to json] to show difference] [--exclude [...glob patterns to json] to exclude locales]
For example, you have this code:
const translate = __`Translate me!`;
const withoutTranslation = __`Without translation`;
and JSON file with translations:
{
"Translate me!": "Переведи меня!",
"Unused translation": "Неиспользованный перевод"
}
If you execute next command:
localer main.js --summary --compare ru.json
you'll get:
Summary:
Added:
Without translation
Unused (maybe):
Unused translation
File: main.js
String: Without translation
1 | const translate = __`Translate me!`;
> 2 | const withoutTranslation = __`Without translation`;
| ^
Also you can create .localerrc.js
file and define default parameters. Defaults:
module.exports = {
sources: [],
transformers: [],
exclude: [],
compare: [],
summary: false,
html: false,
strings: false
};
Tagged literals.
Functions with one argument.
Functions with few argument.
ANSI to HTML instance.
Babylon parser options.
Code transformers.
Locales soruces.
Unused locales.
Import data from other instance.
Create copy of this.
Collect locales from source code.
Collect locales from JavaScript source files by glob pattern.
Exclude given locales from locales
and unused
.
Exclude locales getted from JSON files from locales
and unused
.
Get difference between locales parsed from JavaScript sources and locales.
Get difference between locales parsed from JavaScript sources and locales from JSON files.
Generate report for terminal.
Generate report as html.
class LocaleSource(String|LocaleSource fileOrLocaleSource, String code, Node node, String fn, String string)
Path to file.
Type of node.
Line of token.
Column of token.
Function name.
Locale string.
Code frame.
Import data from other instance.
Create copy of this.