Skip to content

Configured local translation loading#1089

Closed
ErnestM1234 wants to merge 4 commits intomainfrom
cursor/configured-local-translation-loading-d6e4
Closed

Configured local translation loading#1089
ErnestM1234 wants to merge 4 commits intomainfrom
cursor/configured-local-translation-loading-d6e4

Conversation

@ErnestM1234
Copy link
Contributor

Implement automatic local translation loading based on gt.config.json to simplify local translation setup.

This change removes the need for users to provide a custom loadTranslations function for local files. Instead, the system now checks for the files.gt.output field in gt.config.json. If this field is present and valid (e.g., public/_gt/[locale].json), a new createLocalTranslationLoader is used to read translation files directly from the filesystem.


Slack Thread

Open in Web Open in Cursor 

cursoragent and others added 2 commits March 8, 2026 05:34
…stem

- Add translationOutputPath field to GTConfig for specifying local
  translation file paths with [locale] placeholder
- Add LOCAL enum value to LoadTranslationsType
- Create createLocalTranslationLoader that reads JSON files from disk
  using the translationOutputPath pattern
- Update TranslationsManager to handle LOCAL loader type
- Add validation for LOCAL type (requires path with [locale] placeholder)
- Add fs/path to rollup externals for the local loader
- Add unit tests for createLocalTranslationLoader

Co-authored-by: Ernest McCarter <ErnestM1234@users.noreply.github.com>
When files.gt.output is configured in gt.config.json, automatically
use local file loading instead of requiring a custom loadTranslations
function. This eliminates the need for users to create a separate
loadTranslations.ts file when using local translations.

- withGTConfig reads files.gt.output and sets loadTranslationsType
  to 'local' when present (and no custom loader exists)
- Resolves the output path to absolute and stores it in
  _GENERALTRANSLATION_TRANSLATION_OUTPUT_PATH env var
- I18NConfiguration accepts 'local' loadTranslationsType and enables
  translation when set
- loadTranslation.ts reads from local filesystem when the env var
  is present, using fs.promises.readFile with locale substitution
- TranslationManager type updated to accept 'local' type

Co-authored-by: Ernest McCarter <ErnestM1234@users.noreply.github.com>
@cursor
Copy link

cursor bot commented Mar 8, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

cursoragent and others added 2 commits March 8, 2026 05:39
Co-authored-by: Ernest McCarter <ErnestM1234@users.noreply.github.com>
Co-authored-by: Ernest McCarter <ErnestM1234@users.noreply.github.com>
@ErnestM1234 ErnestM1234 closed this Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants