Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] URL formatting showDefaults: false not working as expected with multiple locales #976

Open
adamraya opened this issue Feb 9, 2023 · 1 comment
Labels
Acknowledged Team has responded to issue BUG P3 git2gus label for bug

Comments

@adamraya
Copy link
Collaborator

adamraya commented Feb 9, 2023

Summary

Using the URL formatting showDefaults setting set to false with multiple locales shows the expected URL and content when navigating with the default locale. But switching the locale to another locale different than the default locale using the dropdown selector in the footer component doesn't generate the URL with the selected locale, instead the URL with the default locale is generated and the content is reloaded.

The current workaround is to use showDefaults: true when using multiple locales.

Thanks @clavery for reporting the issue.

Steps To Reproduce

  1. Configure sites for RefArchGlobal using two active locales:
     {
         id: 'RefArchGlobal',
         l10n: {
             supportedCurrencies: ['USD'],
             defaultCurrency: 'USD',
             defaultLocale: 'en-GB',
             supportedLocales: [
                 {
                     id: 'en-GB',
                     // alias: 'us',
                     preferredCurrency: 'USD'
                 },
                 {
                     id: 'fr-FR',
                     // alias: 'us',
                     preferredCurrency: 'USD'
                 }
             ]
         }
     }
    
  2. Configure URLs setting locale option to "path" (leave showDefaults commented out)
  3. Visit the site at the default locale (i.e. '/')
  4. Observe that the default locale works and the second locale ALSO works when explicitly visiting the URL for fr-FR: (i.e. add /fr-FR/ to the url). Browsing this second locale works as expected when browsing (i.e. this appears to be supported).
  5. From the default locale use the "locale selector" dropdown in the footer to select fr-FR
  6. Observe the locale is NOT changed to the selected (the default is reloaded).
  7. Change url configuration setting showDefaults: true
  8. Observe the locale selector dropdown works as expected.

Expected result

Choosing a locale other than the default should generate a URL that includes the selected locale in the URL and the content should be rendered in that locale.

Actual result

After selecting a locale different from the default one, using the locale selector in the footer, the generated URL doesn't contain the locale in the URL and the content is rendered using the default locale.

System Information (as applicable)

Browser:
Node version:
pwa-kit version:
Desktop OS:
Mobile Device Info:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Acknowledged Team has responded to issue BUG P3 git2gus label for bug
Projects
None yet
Development

No branches or pull requests

2 participants