Skip to content

Commit

Permalink
🐛 Fix translations failing (actualbudget#3830)
Browse files Browse the repository at this point in the history
* fix translations failing

* release notes

* blasphemy

* more blasphemy

* putting warning back

* last heretic act

* making the world a better place
  • Loading branch information
MikesGlitch authored Nov 14, 2024
1 parent d08be58 commit 58baf74
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 32 deletions.
20 changes: 8 additions & 12 deletions packages/loot-core/src/server/budget/cleanup-template.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// @ts-strict-ignore
import { t } from 'i18next';

import { Notification } from '../../client/state-types/notifications';
import * as monthUtils from '../../shared/months';
import * as db from '../db';
Expand Down Expand Up @@ -115,7 +113,7 @@ async function applyGroupCleanups(
});
}
} else {
warnings.push(groupName + t(' has no matching sink categories.'));
warnings.push(groupName + ' has no matching sink categories.');
}
sourceGroups = sourceGroups.filter(c => c.group !== groupName);
groupLength = sourceGroups.length;
Expand Down Expand Up @@ -220,7 +218,7 @@ async function processCleanup(month: string): Promise<Notification> {
});
num_sources += 1;
} else {
warnings.push(category.name + t(' does not have available funds.'));
warnings.push(category.name + ' does not have available funds.');
}
const carryover = await db.first(
`SELECT carryover FROM zero_budgets WHERE month = ? and category = ?`,
Expand Down Expand Up @@ -287,7 +285,7 @@ async function processCleanup(month: string): Promise<Notification> {

const budgetAvailable = await getSheetValue(sheetName, `to-budget`);
if (budgetAvailable <= 0) {
warnings.push(t('Global: No funds are available to reallocate.'));
warnings.push('Global: No funds are available to reallocate.');
}

//fill sinking categories
Expand Down Expand Up @@ -322,19 +320,19 @@ async function processCleanup(month: string): Promise<Notification> {
return {
type: 'error',
sticky: true,
message: t('There were errors interpreting some templates:'),
message: 'There were errors interpreting some templates:',
pre: errors.join('\n\n'),
};
} else if (warnings.length) {
return {
type: 'warning',
message: t('Global: Funds not available:'),
message: 'Global: Funds not available:',
pre: warnings.join('\n\n'),
};
} else {
return {
type: 'message',
message: t('All categories were up to date.'),
message: 'All categories were up to date.',
};
}
} else {
Expand All @@ -344,15 +342,13 @@ async function processCleanup(month: string): Promise<Notification> {
if (errors.length) {
return {
sticky: true,
message: t('{applied} There were errors interpreting some templates:', {
applied,
}),
message: `${applied} There were errors interpreting some templates:`,
pre: errors.join('\n\n'),
};
} else if (warnings.length) {
return {
type: 'warning',
message: t('Global: Funds not available:'),
message: 'Global: Funds not available:',
pre: warnings.join('\n\n'),
};
} else {
Expand Down
10 changes: 3 additions & 7 deletions packages/loot-core/src/server/budget/goaltemplates.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// @ts-strict-ignore
import { t } from 'i18next';

import { Notification } from '../../client/state-types/notifications';
import * as monthUtils from '../../shared/months';
import * as db from '../db';
Expand Down Expand Up @@ -190,13 +188,13 @@ async function processTemplate(
if (catObjects.length === 0 && errors.length === 0) {
return {
type: 'message',
message: t('Everything is up to date'),
message: 'Everything is up to date',
};
}
if (errors.length > 0) {
return {
sticky: true,
message: t('There were errors interpreting some templates:'),
message: 'There were errors interpreting some templates:',
pre: errors.join(`\n\n`),
};
}
Expand Down Expand Up @@ -247,8 +245,6 @@ async function processTemplate(

return {
type: 'message',
message: t('Successfully applied templates to {length} categories', {
length: catObjects.length,
}),
message: `Successfully applied templates to ${catObjects.length} categories`,
};
}
9 changes: 2 additions & 7 deletions packages/loot-core/src/server/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import './polyfills';

import * as injectAPI from '@actual-app/api/injected';
import * as CRDT from '@actual-app/crdt';
import { t } from 'i18next';
import { v4 as uuidv4 } from 'uuid';

import { createTestBudget } from '../mocks/budget';
Expand Down Expand Up @@ -1088,18 +1087,14 @@ function handleSyncError(err, acct) {
accountId: acct.id,
message: err.reason
? err.reason
: t(
'Account “{acctName}” is not linked properly. Please link it again.',
{ acctName: acct.name },
),
: `Account “${acct.name}” is not linked properly. Please link it again.`,
};
}

return {
accountId: acct.id,
message: t(
message:
'There was an internal error. Please get in touch https://actualbudget.org/contact for support.',
),
internal: err.stack,
};
}
Expand Down
4 changes: 1 addition & 3 deletions packages/loot-core/src/server/mutators.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// @ts-strict-ignore
import { t } from 'i18next';

import { captureException, captureBreadcrumb } from '../platform/exceptions';
import { sequential } from '../shared/async';
import { type HandlerFunctions, type Handlers } from '../types/handlers';
Expand Down Expand Up @@ -123,7 +121,7 @@ export function getMutatorContext() {
if (currentContext == null) {
captureBreadcrumb({
category: 'server',
message: t('Recent methods: ') + _latestHandlerNames.join(', '),
message: 'Recent methods: ' + _latestHandlerNames.join(', '),
});
// captureException(new Error('getMutatorContext: mutator not running'));

Expand Down
5 changes: 2 additions & 3 deletions packages/loot-core/src/server/sheet.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @ts-strict-ignore
import { type Database } from '@jlongster/sql.js';
import { t } from 'i18next';

import { captureBreadcrumb } from '../platform/exceptions';
import * as sqlite from '../platform/server/sqlite';
Expand Down Expand Up @@ -133,7 +132,7 @@ export async function loadSpreadsheet(
}

captureBreadcrumb({
message: t('loading spreaadsheet'),
message: 'loading spreadsheet',
category: 'server',
});

Expand Down Expand Up @@ -163,7 +162,7 @@ export async function loadSpreadsheet(
}

captureBreadcrumb({
message: t('loaded spreaadsheet'),
message: 'loaded spreadsheet',
category: 'server',
});

Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/3830.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [MikesGlitch]
---

Fix broken translations in worker files

0 comments on commit 58baf74

Please sign in to comment.