Skip to content

fix: integrate FastStore SDK locales method in generate-i18n command - #3162

Merged
hellofanny merged 4 commits into
feat/multilanguagefrom
fix/i18n-locales-method
Jan 14, 2026
Merged

hellofanny merged 4 commits into
feat/multilanguagefrom
fix/i18n-locales-method

Conversation

@lemagnetic

@lemagnetic lemagnetic commented Jan 5, 2026 •

Copy link
Copy Markdown
Contributor

What's the purpose of this pull request?

The generate-i18n command was using temporary mocked data exported from the production code. This PR integrates the real FastStore SDK locales() method, removing the hardcoded mock and making the command fetch actual i18n configuration.

How it works?

This PR makes the following changes:

  • Removes mocked data from production code: The mockedSettings constant was exported from generate-i18n.ts and has been removed
  • Integrates real SDK method: Uncommented and updated the FastStore SDK integration to use the locales() method (updated from the old settings() method)
  • Updates test suite: Moved the mockedSettings to the test file and properly mocked the SDK's locales() method to return test data
  • **Removes locales-setting.jsons mock data references and uses i18n settings instead.

The command now correctly fetches real i18n configuration (locales, regions, currencies) from the VTEX platform when executed with proper credentials.

How to test it?

  1. Set up the required environment variables
  2. Run node packages/cli/bin/run generate-i18n ./packages/core
  3. Verify that the discovery.config.default.js file is updated with i18n configuration fetched from the SDK
  4. Verify if the path strategy continues working by accessing the locales paths, like /pt-BR.
  5. Verify if the subdomain strategy continues working by accessing the urls with locale subdomain

Starters Deploy Preview

N/A - This is a CLI-only change

References

[Jira Task] https://vtex-dev.atlassian.net/jira/software/c/projects/SFS/boards/1055?selectedIssue=SFS-2995

@lemagnetic lemagnetic added the enhancement New feature or request label Jan 5, 2026
@codesandbox-ci

codesandbox-ci Bot commented Jan 5, 2026 •

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@hellofanny hellofanny changed the title fix(cli): integrate FastStore SDK locales method in generate-i18n command fix: integrate FastStore SDK locales method in generate-i18n command Jan 8, 2026
@hellofanny
hellofanny marked this pull request as ready for review January 8, 2026 13:25
@hellofanny
hellofanny requested a review from a team as a code owner January 8, 2026 13:25
@hellofanny
hellofanny requested review from eduardoformiga and renatamottam and removed request for a team January 8, 2026 13:25

@lariciamota lariciamota left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I'd just wait the conclusion of this thread before merging the PR

@hellofanny
hellofanny marked this pull request as draft January 8, 2026 15:02
@hellofanny
hellofanny force-pushed the fix/i18n-locales-method branch from fdf86d2 to 754b091 Compare January 8, 2026 19:58
@hellofanny
hellofanny marked this pull request as ready for review January 9, 2026 14:29
@hellofanny
hellofanny merged commit 6ce4aa6 into feat/multilanguage Jan 14, 2026
@hellofanny
hellofanny deleted the fix/i18n-locales-method branch January 14, 2026 13:25
lemagnetic added a commit that referenced this pull request Mar 5, 2026
## What's the purpose of this pull request?

Removing hardcoded labels:
- #3099
- #3102 
- #3107 
- #3104 
- #3103 
- #3125
- #3131
- #3116
- #3142
- #3192

Setting Up locales
- #3141
- #3143
- #3147
- #3156
- #3162
- #3145
- #3164
- #3169
- #3171
- #3176
- #3180
- #3169
 custom path
- #3185
- #3162
- #3156
- #3170

Components
- #3093
- #3175

Fetching content 

- #3165

Others
- #3176
- #3171
- #3181
- #3189
- #3205


## How to test locally?
- Run `pnpm I` (install all the new dependencies and needed packages)
- If you want to try localization feature, go
to`/discovery.config.default.js`:
Enable localization:
```
localization: {
  enabled: true
}
```
- Run `node packages/cli/bin/run.js generate-i18n ./packages/core` to
fetch the bindings

If the contentSource is not set to content platform yet, you will see a
message to update to it.
>   contentSource: {
>     type: 'CP',
>   },

⚠️ Note: Ensure the url is set to localhost for local testing. These
locale bindings are generated in `discovery.config` after running the
generate-i18n command.

```diff
localization: {
  enabled: true,
  defaultLocale: 'en-US',
   regions: {...},
    locales: {
      'pt-BR': {
           ...
        bindings: [
          {
            currencyCode: 'BRL',
-           url: 'https://brandless.fast.store/pt-BR',
+           url: 'http://localhost:3000/pt-BR',
            salesChannel: '2',
            isDefault: true,
            locales: [
              {
                code: 'pt-BR',
                isDefault: true,
              },
            ],
          },
        ],
      },
      'it-IT': {
        ...
        bindings: [
          {
            currencyCode: 'EUR',
-           url: 'https://brandless.fast.store/it-IT',
+           url: 'http://localhost:3000/it-IT',
            salesChannel: '3',
            isDefault: true,
            locales: [
              {
                code: 'it-IT',
                isDefault: true,
              },
            ],
          },
          {
            currencyCode: 'EUR',
-           url: 'https://brandless.fast.store/europe/it',
+           url: 'http://localhost:3000/europe/it',
            salesChannel: '3',
            isDefault: false,
            locales: [
              {
                code: 'it-IT',
                isDefault: true,
              },
            ],
          },
        ],
      },
      'en-US': {
        code: 'en-US',
        name: 'English',
        languageCode: 'en',
        languageName: 'English',
        script: 'Latn',
        textDirection: 'ltr',
        regionCode: 'US',
        bindings: [
          {
            currencyCode: 'USD',
-           url: 'https://brandless.fast.store',
+           url: 'http://localhost:3000,
            salesChannel: '1',
            isDefault: true,
            locales: [
              {
                code: 'en-US',
                isDefault: true,
              },
            ],
          },
        ],
      },
    ...
}
```

- Go to /packages/core and run `npmn dev`

---------

Co-authored-by: Larícia Mota <[email protected]>
Co-authored-by: Leandro Rodrigues <[email protected]>
Co-authored-by: Otavio Moreira Meirelles <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants