1
1
// @ts -strict-ignore
2
+ import { t } from 'i18next' ;
3
+
2
4
import { Notification } from '../../client/state-types/notifications' ;
3
5
import * as monthUtils from '../../shared/months' ;
4
6
import * as db from '../db' ;
@@ -113,7 +115,7 @@ async function applyGroupCleanups(
113
115
} ) ;
114
116
}
115
117
} else {
116
- warnings . push ( groupName + ' has no matching sink categories.' ) ;
118
+ warnings . push ( groupName + t ( ' has no matching sink categories.' ) ) ;
117
119
}
118
120
sourceGroups = sourceGroups . filter ( c => c . group !== groupName ) ;
119
121
groupLength = sourceGroups . length ;
@@ -218,7 +220,7 @@ async function processCleanup(month: string): Promise<Notification> {
218
220
} ) ;
219
221
num_sources += 1 ;
220
222
} else {
221
- warnings . push ( category . name + ' does not have available funds.' ) ;
223
+ warnings . push ( category . name + t ( ' does not have available funds.' ) ) ;
222
224
}
223
225
const carryover = await db . first (
224
226
`SELECT carryover FROM zero_budgets WHERE month = ? and category = ?` ,
@@ -285,7 +287,7 @@ async function processCleanup(month: string): Promise<Notification> {
285
287
286
288
const budgetAvailable = await getSheetValue ( sheetName , `to-budget` ) ;
287
289
if ( budgetAvailable <= 0 ) {
288
- warnings . push ( 'Global: No funds are available to reallocate.' ) ;
290
+ warnings . push ( t ( 'Global: No funds are available to reallocate.' ) ) ;
289
291
}
290
292
291
293
//fill sinking categories
@@ -320,19 +322,19 @@ async function processCleanup(month: string): Promise<Notification> {
320
322
return {
321
323
type : 'error' ,
322
324
sticky : true ,
323
- message : ` There were errors interpreting some templates:` ,
325
+ message : t ( ' There were errors interpreting some templates:' ) ,
324
326
pre : errors . join ( '\n\n' ) ,
325
327
} ;
326
328
} else if ( warnings . length ) {
327
329
return {
328
330
type : 'warning' ,
329
- message : 'Global: Funds not available:' ,
331
+ message : t ( 'Global: Funds not available:' ) ,
330
332
pre : warnings . join ( '\n\n' ) ,
331
333
} ;
332
334
} else {
333
335
return {
334
336
type : 'message' ,
335
- message : 'All categories were up to date.' ,
337
+ message : t ( 'All categories were up to date.' ) ,
336
338
} ;
337
339
}
338
340
} else {
@@ -342,13 +344,15 @@ async function processCleanup(month: string): Promise<Notification> {
342
344
if ( errors . length ) {
343
345
return {
344
346
sticky : true ,
345
- message : `${ applied } There were errors interpreting some templates:` ,
347
+ message : t ( '{applied} There were errors interpreting some templates:' , {
348
+ applied,
349
+ } ) ,
346
350
pre : errors . join ( '\n\n' ) ,
347
351
} ;
348
352
} else if ( warnings . length ) {
349
353
return {
350
354
type : 'warning' ,
351
- message : 'Global: Funds not available:' ,
355
+ message : t ( 'Global: Funds not available:' ) ,
352
356
pre : warnings . join ( '\n\n' ) ,
353
357
} ;
354
358
} else {
0 commit comments