Skip to content

Commit 961ad96

Browse files
committed
dev-demo: add translation review checkboxes
1 parent 1ab843b commit 961ad96

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- AlterTable
2+
ALTER TABLE "translations" ADD COLUMN "reviewed" TEXT;

dev-demo/resources/translation.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import AdminForth, {
55
import CompletionAdapterOpenAIChatGPT from "../../adapters/adminforth-completion-adapter-open-ai-chat-gpt";
66
import I18nPlugin from "../../plugins/adminforth-i18n";
77
import { randomUUID } from "crypto";
8+
import ListInPlaceEditPlugin from "../../plugins/adminforth-list-in-place-edit";
89

910

1011
export default {
@@ -55,6 +56,9 @@ export default {
5556
// will hel to filter out incomplete translations
5657
completedFieldName: 'completedLangs',
5758

59+
// optional field to enable "Reviewed" checkbox for each translation string
60+
reviewedCheckboxesFieldName: 'reviewed',
61+
5862
completeAdapter: new CompletionAdapterOpenAIChatGPT({
5963
openAiApiKey: process.env.OPENAI_API_KEY as string,
6064
model: 'gpt-4o',
@@ -64,7 +68,6 @@ export default {
6468
},
6569
}),
6670
}),
67-
6871
],
6972
options: {
7073
listPageSize: 100,
@@ -124,6 +127,13 @@ export default {
124127
name: "category",
125128
showIn: ['filter', 'show', 'list'],
126129
type: AdminForthDataTypes.STRING,
130+
},
131+
{
132+
name: "reviewed",
133+
type: AdminForthDataTypes.JSON,
134+
showIn: {
135+
all: false,
136+
}
127137
}
128138
],
129139
} as AdminForthResourceInput;

dev-demo/schema.prisma

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ model translations {
8383
category String
8484
source String?
8585
completedLangs String?
86+
87+
reviewed String?
8688
8789
// we need both indexes on en_string+category and separately on category
8890
@@index([en_string, category])

0 commit comments

Comments
 (0)