question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[gatsby-source-contentful] Fallback to default locale on non-localised fields

See original GitHub issue

For fields that are set not to be localised in Contentful and language fallback for foreign languages turned off in Contentful I think Gatsby should use the value of the field from the default language.

We for example have name field for each content type inside Contentful that is set not to be localised. Currently Gatsby will just set the value of name for other locales to null. The same applies for many of the images we have in Contentful that we have set not to be localised and would like to use the same image for each locale, but currently this doesn’t seem to be possible.

Seems that #2539 changed the behaviour of the locale fallbacks, but this particular use case is not covered by it.

This might not be 100% in line with Contentful’s behaviour, so maybe this could be configurable option in gatsby-source-contentful?

I’m happy to do a PR if you think this is legitimate suggestion.

Or is there some other way to fallback to the default locale for fields that are set not to be localised?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
anjawaldbauercommented, Feb 14, 2018

Hi @evuolas, are you still on this PR? I would hate to steal your thunder, but I think this is still an open issue and would love to bring this issue to a close.

1reaction
Khaledgarbayacommented, Nov 17, 2017

Hi @evuolas , That’s a good starting point. I would say you add some tests and start a PR and I will give you some more testing scenarios for your solution, once we cover all of them we can merge it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set a fallback locale - Feature requests - DatoCMS community
10 locales in our project/model; Field Title i18n; Field Title with default language for en, fr; Field Title with required at least one...
Read more >
How to avoid Globalize3 from returning fallback translations ...
I've done this because I want to show the default translation if there isn't a translation or is empty in the current locale...
Read more >
Manage Localization for a Page Designer Page
From the visual editor, open the Page Designer page. Select the locale from the top drop-down menu. The page banner displays the fallback...
Read more >
Fallback localization | Vue I18n
# Explicit fallback with one locale ... By default, falling back to fallbackLocale generates two console warnings: [vue-i18n] Value of key 'hello' ...
Read more >
Internationalization in RAP - Eclipse
The default locale can be set by adding the system property user.language ... Note: The ResourceBundle fallback mechanism can sometimes lead to confusion....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found