feat(portal): Co-Lite labels only filter on Translations
On by default. The portal server sends its own label codes to the new search; unchecking lists every label as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
This commit is contained in:
1 parent
d2cbc3c227
commit
918f5fa2b2
12 files changed
+70
-8
No files matched your search
@@ -30,7 +30,7 @@ None.
|
||||
- `app/api/messages/[[...path]]/route.ts`;
|
||||
- `app/lib/services/translations.ts`;
|
||||
- `app/messages/page.tsx`;
|
||||
- two new labels in `defaultMessages.ts` and `zh_CN.seed.json`, so the Chinese SQL is regenerated.
|
||||
- **Deploy:** `add-zh-cn-messages/sql/03-zh-cn-messages.sql` is regenerated and now also includes the two new labels. An environment that has already run 03 must not run it again, because it would overwrite reviewed Chinese. It runs this change's `sql/01-colite-filter-labels.sql` instead, which holds only the two new labels and is built by the same generator. The deployment doc states which file to run.
|
||||
- one new label in `defaultMessages.ts` and `zh_CN.seed.json`, so the Chinese SQL is regenerated.
|
||||
- **Deploy:** `add-zh-cn-messages/sql/03-zh-cn-messages.sql` is regenerated and now also includes the new label. An environment that has already run 03 must not run it again, because it would overwrite reviewed Chinese. It runs this change's `sql/01-colite-filter-labels.sql` instead, which holds only the new label and is built by the same generator. The deployment doc states which file to run.
|
||||
|
||||
Design: `docs/superpowers/specs/2026-12-02-messages-colite-filter-design.md`.
|
||||
@@ -0,0 +1,6 @@
|
||||
-- The label added by add-messages-colite-filter, cut from the output of `npm run i18n:sql`. Run it only in an environment that already ran add-zh-cn-messages/sql/03-zh-cn-messages.sql; otherwise run that 03 file, which includes this label.
|
||||
SET NAMES utf8mb4;
|
||||
USE `service-system`;
|
||||
INSERT INTO message (code, content, area) SELECT 'MsgsOwnLabelsFilter', JSON_OBJECT('en_US', 'Co-Lite labels only', 'zh_CN', '仅 Co-Lite 标签'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('MsgsOwnLabelsFilter') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '仅 Co-Lite 标签') WHERE LOWER(code) = LOWER('MsgsOwnLabelsFilter') AND area = 'A';
|
||||
UPDATE catalog_meta SET version = version + 1, updated_at = NOW() WHERE id = 1;
|
||||
@@ -14,8 +14,8 @@ Design: `docs/superpowers/specs/2026-12-02-messages-colite-filter-design.md`. Ev
|
||||
|
||||
## 3. Portal
|
||||
|
||||
- [ ] 3.1 The list route posts to the new endpoint. It sends `codes` built on the server from `DEFAULT_MESSAGES` keys, unless the request asks for all labels.
|
||||
- [ ] 3.2 Translations page: a "Co-Lite labels only" checkbox, on by default, kept in the list filters. Add its labels to `defaultMessages.ts` and `zh_CN.seed.json`, then regenerate the Chinese SQL. Write this change's `sql/01-colite-filter-labels.sql` with the new labels only.
|
||||
- [x] 3.1 The list route posts to the new endpoint. It sends `codes` built on the server from `DEFAULT_MESSAGES` keys, unless the request asks for all labels.
|
||||
- [x] 3.2 Translations page: a "Co-Lite labels only" checkbox, on by default, kept in the list filters. Add its label to `defaultMessages.ts` and `zh_CN.seed.json`, then regenerate the Chinese SQL. Write this change's `sql/01-colite-filter-labels.sql` with the new label only.
|
||||
- Verify (3.1 and 3.2): `cd solvway-admin-portal && npx vitest run; echo VITEST=$? && npx tsc --noEmit && npm run lint`
|
||||
|
||||
## 4. Release
|
||||
|
||||
@@ -1355,6 +1355,8 @@ INSERT INTO message (code, content, area) SELECT 'MsgsSearchPlaceholder', JSON_O
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '代码、英文或中文') WHERE LOWER(code) = LOWER('MsgsSearchPlaceholder') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'MsgsMissingChineseFilter', JSON_OBJECT('en_US', 'Missing Chinese', 'zh_CN', '缺少中文'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('MsgsMissingChineseFilter') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '缺少中文') WHERE LOWER(code) = LOWER('MsgsMissingChineseFilter') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'MsgsOwnLabelsFilter', JSON_OBJECT('en_US', 'Co-Lite labels only', 'zh_CN', '仅 Co-Lite 标签'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('MsgsOwnLabelsFilter') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '仅 Co-Lite 标签') WHERE LOWER(code) = LOWER('MsgsOwnLabelsFilter') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'MsgsBadgeMissing', JSON_OBJECT('en_US', 'Missing', 'zh_CN', '缺少'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('MsgsBadgeMissing') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '缺少') WHERE LOWER(code) = LOWER('MsgsBadgeMissing') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'MsgsBadgeSameAsEnglish', JSON_OBJECT('en_US', 'Same as English', 'zh_CN', '与英文相同'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('MsgsBadgeSameAsEnglish') AND area = 'A');
|
||||
|
||||
Reference in new issue
Block a user