Skip to content

Commit

Permalink
fix: translate job confirm messages
Browse files Browse the repository at this point in the history
  • Loading branch information
felixmosh committed Sep 15, 2024
1 parent f50e102 commit 6ffff3b
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/ui/localesSync.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
primaryLanguage: 'en-US',
secondaryLanguages: ['pt-BR'],
secondaryLanguages: ['pt-BR', 'fr-FR', 'zh-CN'],
localesFolder: './src/static/locales',
spaces: 2,
};
9 changes: 6 additions & 3 deletions packages/ui/src/hooks/useJob.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { AppJob, JobRetryStatus } from '@bull-board/api/typings/app';
import { useTranslation } from 'react-i18next';
import { create } from 'zustand';
import { JobActions, Status } from '../../typings/app';
import { getConfirmFor } from '../utils/getConfirmFor';
Expand Down Expand Up @@ -32,6 +33,8 @@ export function useJob(): Omit<JobState, 'updateJob'> & { actions: JobActions }
actions: { updateQueues },
} = useQueues();

const { t } = useTranslation();

const { confirmJobActions, pollingInterval } = useSettingsStore(
({ confirmJobActions, pollingInterval }) => ({
confirmJobActions,
Expand All @@ -53,21 +56,21 @@ export function useJob(): Omit<JobState, 'updateJob'> & { actions: JobActions }
const promoteJob = (queueName: string) => (job: AppJob) =>
withConfirmAndUpdate(
() => api.promoteJob(queueName, job.id),
'Are you sure that you want to promote this job?',
t('JOB.ACTIONS.CONFIRM.PROMOTE'),
confirmJobActions
);

const retryJob = (queueName: string, status: JobRetryStatus) => (job: AppJob) =>
withConfirmAndUpdate(
() => api.retryJob(queueName, job.id, status),
'Are you sure that you want to retry this job?',
t('JOB.ACTIONS.CONFIRM.RETRY'),
confirmJobActions
);

const cleanJob = (queueName: string) => (job: AppJob) =>
withConfirmAndUpdate(
() => api.cleanJob(queueName, job.id),
'Are you sure that you want to clean this job?',
t('JOB.ACTIONS.CONFIRM.CLEAN'),
confirmJobActions
);

Expand Down
14 changes: 12 additions & 2 deletions packages/ui/src/static/locales/en-US/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@
"ACTIONS": {
"PROMOTE": "Promote",
"CLEAN": "Clean",
"RETRY": "Retry"
"RETRY": "Retry",
"CONFIRM": {
"PROMOTE": "Are you sure that you want to promote this job?",
"RETRY": "Are you sure that you want to retry this job?",
"CLEAN": "Are you sure that you want to clean this job?"
}
},
"TABS": {
"DATA": "Data",
Expand Down Expand Up @@ -79,7 +84,12 @@
"CONFIRM": {
"DEFAULT_TITLE": "Are you sure?",
"CONFIRM_BTN": "Confirm",
"CANCEL_BTN": "Cancel"
"CANCEL_BTN": "Cancel",
"JOB": {
"PROMOTE": "Are you sure that you want to promote this job?",
"RETRY": "Are you sure that you want to retry this job?",
"CLEAN": "Are you sure that you want to clean this job?"
}
},
"MODAL": {
"CLOSE_BTN": "Close"
Expand Down
13 changes: 11 additions & 2 deletions packages/ui/src/static/locales/fr-FR/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
},
"DASHBOARD": {
"JOBS_COUNT_one": "{{count}} Tâche",
"JOBS_COUNT_many": "{{count}} Job",
"JOBS_COUNT_other": "{{count}} Job",
"JOBS_COUNT": "{{count}} Tâches"
},
"JOB": {
Expand Down Expand Up @@ -37,7 +39,12 @@
"ACTIONS": {
"PROMOTE": "Promouvoir",
"CLEAN": "Supprimer",
"RETRY": "Réessayer"
"RETRY": "Réessayer",
"CONFIRM": {
"PROMOTE": "Êtes-vous sûr de vouloir promouvoir ce poste ?",
"RETRY": "Êtes-vous sûr de vouloir réessayer ce poste ?",
"CLEAN": "Êtes-vous sûr de vouloir nettoyer ce poste ?"
}
},
"TABS": {
"DATA": "Données",
Expand Down Expand Up @@ -107,7 +114,9 @@
"OFF": "Désactivé",
"SECS": "{{count}} secondes",
"MINS": "{{count}} minutes",
"MINS_one": "{{count}} minute"
"MINS_one": "{{count}} minute",
"MINS_many": "{{count}} minutes",
"MINS_other": "{{count}} minutes"
},
"DEFAULT_JOB_TAB": "Onglet de tâche par défaut",
"JOBS_PER_PAGE": "Tâches par page (1-50)",
Expand Down
10 changes: 8 additions & 2 deletions packages/ui/src/static/locales/pt-BR/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@
"ACTIONS": {
"PROMOTE": "Promover",
"CLEAN": "Limpar",
"RETRY": "Tente Novamente"
"RETRY": "Tente Novamente",
"CONFIRM": {
"PROMOTE": "Você tem certeza de que deseja promover este trabalho?",
"RETRY": "Você tem certeza de que deseja tentar novamente este trabalho?",
"CLEAN": "Você tem certeza de que deseja limpar este trabalho?"
}
},
"TABS": {
"DATA": "Dados",
Expand All @@ -58,6 +63,7 @@
"RESUME": "Resumir",
"PAUSE": "Pausar",
"EMPTY": "Limpar",
"ADD_JOB": "Adicionar trabalho",
"RETRY_ALL_CONFIRM_MSG": "Deseja realmente reprocessar todos as {{status}} tarefas?",
"CLEAN_ALL_CONFIRM_MSG": "Deseja realmente limpar todos as {{status}} tarefas?",
"PROMOTE_ALL_CONFIRM_MSG": "Deseja realmente promover todas as tarefas atrasadas?",
Expand Down Expand Up @@ -129,4 +135,4 @@
"JOB_OPTIONS": "Opções da tarefa",
"ADD": "Adicionar"
}
}
}
11 changes: 7 additions & 4 deletions packages/ui/src/static/locales/zh-CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"PAUSED": "已暂停"
},
"DASHBOARD": {
"JOBS_COUNT_one": "{{count}} 个作业",
"JOBS_COUNT": "{{count}} 个作业"
},
"JOB": {
Expand Down Expand Up @@ -37,7 +36,12 @@
"ACTIONS": {
"PROMOTE": "提升",
"CLEAN": "清理",
"RETRY": "重试"
"RETRY": "重试",
"CONFIRM": {
"PROMOTE": "您确定要推广这项工作吗?",
"RETRY": "您确定要重试这项工作吗?",
"CLEAN": "您确定要清理这项工作吗?"
}
},
"TABS": {
"DATA": "数据",
Expand Down Expand Up @@ -106,8 +110,7 @@
"POLLING_OPTIONS": {
"OFF": "关闭",
"SECS": "{{count}} 秒",
"MINS": "{{count}} 分钟",
"MINS_one": "{{count}} 分钟"
"MINS": "{{count}} 分钟"
},
"DEFAULT_JOB_TAB": "默认作业选项卡",
"JOBS_PER_PAGE": "每页作业数量(1-50)",
Expand Down

0 comments on commit 6ffff3b

Please sign in to comment.