Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Lara Cli automates translation of your i18n files with a single command, preserv

Supports multiple file formats including JSON, PO (gettext), TypeScript, Vue I18n single-file components, Markdown and MDX files, Android XML string resource files, Xcode localization files (.strings, .stringsdict, .xcstrings), and plain text (.txt) files. See [Supported Formats](docs/config/formats.md) for details.

[![Version](https://img.shields.io/badge/version-1.7.2-blue.svg)](https://github.com/translated/lara-cli)
[![Version](https://img.shields.io/badge/version-1.7.3-blue.svg)](https://github.com/translated/lara-cli)

</div>

Expand Down Expand Up @@ -231,7 +231,8 @@ because a server can accept a batch even if its response never reaches the CLI.
The CLI keeps one pending milestone across commands and remembers it after ingestion acknowledges
it. Repeating `init`, translating again or rotating an API key for the same account does not create
another milestone. Each command still records its own `call_success` or `call_error`;
`auth_fail` remains a diagnostic event for failed authentication attempts.
`auth_fail` remains a diagnostic event for failed authentication attempts. A command stopped by an
exhausted plan quota records `quota_exceeded` instead of `call_error`.

`sessionId` groups commands from the same account on the same machine, including across projects.
Each command renews the session; 30 minutes without activity starts a new one. Switching accounts
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@translated/lara-cli",
"type": "module",
"version": "1.7.2",
"version": "1.7.3",
Comment thread
Starllordz marked this conversation as resolved.
Resolved
"description": "CLI tool for automated i18n file translation using Lara Translate",
"repository": {
"type": "git",
Expand Down
17 changes: 17 additions & 0 deletions src/__tests__/modules/metrics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,23 @@ describe('finishCommand', () => {
expect(typeof queuedEvents()[0]!.latencyMs).toBe('number');
});

it.each([
['directly', [new Error('Your plan quota is exhausted')]],
[
'before a generic unwind error',
[new Error('Your plan quota is exhausted'), new Error('Some files could not be translated')],
],
])('emits quota_exceeded instead of call_error when quota runs out %s', async (_, errors) => {
const metrics = await loadMetrics();
metrics.instrument('translate');
for (const error of errors) metrics.recordError(error);
metrics.finishCommand(1);

const event = queuedEvents()[0]!;
expect(event).toMatchObject({ eventType: 'quota_exceeded' });
expect(event).not.toHaveProperty('errorType');
});

it.each([
['text', 'text', { sourceLang: 'en', targetLang: 'pt-br' }],
['file', 'document', { sourceLang: 'en', targetLang: 'pt-br' }],
Expand Down
13 changes: 8 additions & 5 deletions src/modules/metrics/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -973,11 +973,14 @@ export function finishCommand(exitCode: number): void {
};

if (exitCode !== 0) {
queueEvent({
eventType: 'call_error',
errorType: errorTypeFor(lastError),
...common,
});
// A plan running out of characters is not the CLI failing: it gets its own
// event so the error funnel only counts real failures.
const errorType = errorTypeFor(lastError);
queueEvent(
errorType === 'quota_exceeded'
? { eventType: 'quota_exceeded', ...common }
: { eventType: 'call_error', errorType, ...common }
);
return;
}

Expand Down
Loading