Comments (5)
@hbjydev Can you take a look at this? I've done some work and pushed some changes in the develop
branch with no luck. The switcher works properly when running the dev server locally, so the issue only occurs after build. I originally thought it might have been something to do with RSS because of some console errors but I completely removed it and the issue still persisted. I don't have the best knowledge when it comes to the i18n stuff and I'm not seeing anything extremely apparent that would be causing such an issue.
from rockylinux.org-gatsby.
I've taken a look and it seems to be that only the current locale is loaded at any given time. This happens because of the load: 'currentOnly'
in gatsby-config.js
. I see two ways that this can be fixed.
Either load all locales at all times:
diff --git a/gatsby-config.js b/gatsby-config.js
index f97d085..6bcd3f9 100644
--- a/gatsby-config.js
+++ b/gatsby-config.js
@@ -111,7 +111,7 @@ module.exports = {
],
fallbackLng: 'en',
lowerCaseLng: 'true',
- load: 'currentOnly',
+ load: 'all',
ns: ['translation'],
returnObjects: true,
interpolation: {
or instead of doing a client-side navigate, do a full page reload on locale change:
diff --git a/src/components/footer/index.jsx b/src/components/footer/index.jsx
index df7f43d..c34b750 100644
--- a/src/components/footer/index.jsx
+++ b/src/components/footer/index.jsx
@@ -163,11 +163,11 @@ const Footer = ({ pageContext: { locale: language } }) => {
</h5>
<select
id="languagePicker"
- onChange={(e) =>
- navigate(
- `${e.target.value === 'en' ? `/` : `/${e.target.value}`}`
- )
- }
+ onChange={(e) => {
+ window.location.href = `${
+ e.target.value === 'en' ? `/` : `/${e.target.value}`
+ }`;
+ }}
name="language"
className="mt-1 mr-2 block w-full pl-2 pr-8 py-1 text-sm text-black dark:text-white border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 focus:outline-none focus:ring-green-500 focus:border-green-500 sm:text-sm rounded-md"
aria-label="Language Select"
I think option 2 is more favorable but that is for you all to decide
from rockylinux.org-gatsby.
Full page reload is definitely the favorable option. I'm using Lighthouse audits as a performance benchmark and we will take a big hit on load times if we do the load: 'all'
version.
Can you open a PR for this @mstg?
from rockylinux.org-gatsby.
That way we get a Vercel preview build we can test it with
from rockylinux.org-gatsby.
@hbjydev I am also definitely in favor of performance and therefore option 2. Opened #26
from rockylinux.org-gatsby.
Related Issues (20)
- Add landing page for community tab on website
- Translation Completed: <Japanese>
- The link for the ARM Desktop/Workstation edition of Rocky9 is returning a 404
- Where has `/etc/default/grup` been moved ? HOT 1
- Please update AMI listing on website HOT 1
- Rocky Cloud Images page is missing date and type/variant fields HOT 2
- cloud-images page should include the date published and/or name of the AMIs HOT 3
- Add ACT to Partners Page
- Rocky Torrent Downloads Fail HOT 5
- Links to ISO's are using a symlinked version meant for osinfo
- Update Raspberry Pi links on Alternative Images page HOT 1
- Translation Completed: Afrikaans HOT 1
- Translation Completed: Czech, Čeština HOT 1
- Translation Completed: Indonesian, Bahasa Indonesia HOT 1
- Torrents missing for ppc64le HOT 1
- Failed Migration tor Rocky: Found a full or partial RockyLinux install already in place HOT 1
- `mirrors.rockylinux.org` static resources are served absolutely wrong HOT 5
- Need to add 8.9 and 9.3 AMI IDs HOT 1
- Possibility of keeping old versions HOT 2
- Japanese Translation Issue HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rockylinux.org-gatsby.