From 3bd74dcf39f468277bfa20d44d2116534e5ba0da Mon Sep 17 00:00:00 2001 From: sno Date: Fri, 9 Jan 2026 07:46:12 +0900 Subject: [PATCH] fix: enable immediate file saving for i18n translations (#7785) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Fixes the pt-BR locale generation issue by enabling immediate file persistence in the lobe-i18n configuration. ## Problem The pt-BR locale was added in PR #6943 with proper infrastructure, but translation files have remained empty (`{}`) despite the i18n workflow running successfully on version-bump PRs. ### Root Cause The `lobe-i18n` tool has a `saveImmediately` configuration option (defaults to `false`) that controls whether translations are persisted to disk immediately during generation. When bootstrapping from completely empty `{}` JSON files, without `saveImmediately: true`, the tool generates translations in memory but doesn't write them to disk, resulting in empty files. **Evidence:** - All other locales: ~1,931 lines each (previously bootstrapped) - pt-BR before fix: 1 line (`{}` in all 4 files) - CI workflow runs successfully but pt-BR files remain empty - After adding `saveImmediately: true`: 18,787 lines generated across all 4 pt-BR files ## Solution Add `saveImmediately: true` to `.i18nrc.cjs` configuration: ```javascript module.exports = defineConfig({ modelName: 'gpt-4.1', splitToken: 1024, saveImmediately: true, // ← Enables immediate file persistence entry: 'src/locales/en', entryLocale: 'en', output: 'src/locales', outputLocales: ['zh', 'zh-TW', 'ru', 'ja', 'ko', 'fr', 'es', 'ar', 'tr', 'pt-BR'], // ... }); ``` This ensures that when lobe-i18n generates translations from empty files, they are immediately written to disk rather than kept only in memory. ## Validation This PR's commit history demonstrates the fix works: 1. **Commit `22e6e28f5`**: Applied the `saveImmediately: true` fix 2. **Commit `cd7e93786`**: Temporarily enabled i18n workflow for this branch (for testing) 3. **Commit `84545c218`**: CI successfully generated complete pt-BR translations: - `commands.json`: 327 lines - `main.json`: 2,458 lines - `nodeDefs.json`: 15,539 lines - `settings.json`: 463 lines - **Total: 18,787 lines of Portuguese translations** 4. **Commits `85f282f98` & `05d097f7b`**: Reverted test commits to keep PR minimal ## Changes - `.i18nrc.cjs`: Added `saveImmediately: true` configuration option (+1 line) ## Impact After this fix is merged, future `version-bump-*` PRs will automatically generate and persist pt-BR translations alongside all other locales, keeping Portuguese (Brazil) translations up-to-date with the codebase. ## References - Original issue: https://github.com/Comfy-Org/ComfyUI_frontend/pull/6943#issuecomment-3679664466 - Related PR: #6943 (Portuguese (Brazil) locale addition) - lobe-i18n documentation: https://github.com/lobehub/lobe-cli-toolbox/tree/master/packages/lobe-i18n Fixes #6943 (comment) --------- Co-authored-by: github-actions Co-authored-by: Alexander Brown --- .i18nrc.cjs | 1 + 1 file changed, 1 insertion(+) diff --git a/.i18nrc.cjs b/.i18nrc.cjs index 14c958591..f0ed79099 100644 --- a/.i18nrc.cjs +++ b/.i18nrc.cjs @@ -6,6 +6,7 @@ const { defineConfig } = require('@lobehub/i18n-cli'); module.exports = defineConfig({ modelName: 'gpt-4.1', splitToken: 1024, + saveImmediately: true, entry: 'src/locales/en', entryLocale: 'en', output: 'src/locales',