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

feat(theme-i18n) Allow localization of a subset of pages for individual locales #133

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

olivier-lacroix
Copy link

@olivier-lacroix olivier-lacroix commented May 31, 2021

Hi,

This PR fixes #128

  • an optional pages parameter for each locale allows to limit generation of localized pages by providing an array of RexExp strings
  • localizedPath (LocalizedRouter and LocalizedLink as well) falls back to defaultLang when pointing to a page that has not been localized in the locale.
  • LocalizedLink will only fall back to defaultLang if language is not explicitly set. This avoids having the active class triggered in a language switcher for instance.

Some further thoughts/options:

  • RegExps could be replaced by more friendly path patterns, by adding a dependency to node-match-path.
  • Alternatively, the fallback behaviour may be controlled via a fallback prop on LocalizedLink instead of relying on the language prop.

@olivier-lacroix olivier-lacroix changed the title Allow localization of a subset of pages only for individual locales Allow localization of a subset of pages for individual locales Jun 1, 2021
@olivier-lacroix olivier-lacroix changed the title Allow localization of a subset of pages for individual locales feat(theme-i18n) Allow localization of a subset of pages for individual locales Feb 13, 2022
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.

[gatsby-theme-i18n] limit generation of localised pages to a subset of pages only
1 participant