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

[NextJs] i18n updates #493

Merged
merged 7 commits into from
Nov 17, 2020
Merged

[NextJs] i18n updates #493

merged 7 commits into from
Nov 17, 2020

Conversation

ambrauer
Copy link
Contributor

@ambrauer ambrauer commented Nov 13, 2020

Updates after further i18n analysis / testing, including:

  • Consolidate default language/locale settings (always defer to package.json config language)
  • Allow sample to run with Next.js i18n disabled
  • Add locale variations of configured rewrites (for Sitecore requests pass-through e.g. /sitecore, /media, /layouts)
  • Upgraded next-localization (w/ rosetta) library as dictionary solution of choice. Simplified usage examples. Updated comments in _app.tsx.
  • Remove export scripts for now (since it doesn't work with next.js v10 i18n and image optimization), to be addressed in separate task

Known limitations / open issues:

  • Root page client-side route for 'da-DK' shows 404
  • i18n support is not compatible with next export
  • Cannot force sub-path/prefix usage for default locale
    • Currently breaking test for multilingual styleguide component (English href is "/styleguide" instead of expected "/en/styleguide")
    • Would be preferred with "always" languageEmbedding in Sitecore
    • This doesn't mean it won't resolve the route, just that next/link does not add it
    • RESOLUTION:
      • Fix/enhancement is in the works in Next.js
      • In the meantime, workaround would be to add the prefix yourself in all client routing. e.g.
      <Link href={`${router.locale}/styleguide`} locale={false}>
        <a className="p-2 text-dark">{i18n.t('Styleguide')}</a>
      </Link>
      

Copy link
Contributor

@sc-illiakovalenko sc-illiakovalenko left a comment

Choose a reason for hiding this comment

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

@ambrauer For me, everything is fine. Will we store somewhere these limitations/issues?

@ambrauer
Copy link
Contributor Author

@sc-illiakovalenko Yep, these limitations are covered in docs and/or backlog items.

@ambrauer ambrauer closed this Nov 17, 2020
@ambrauer ambrauer reopened this Nov 17, 2020
@ambrauer ambrauer merged commit f1b4417 into dev Nov 17, 2020
@ambrauer ambrauer deleted the feature/439740 branch November 17, 2020 13:48
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