Giter Site home page Giter Site logo

Comments (5)

kalwalt avatar kalwalt commented on May 24, 2024

Hi;
When you click on the flag and visit http://127.0.0.1:8000/it/ than click on the English flag to return to the English version it end with a double slash
http://127.0.0.1:8000/en//
note the same thing happen when you are at http://127.0.0.1:8000/en/ and click on the Italian flag.

Yes @JOduMonT i saw this, but hadn't the time to fix.
I think i need to add another check in this function

const setLangsMenu = ( langsMenu, id, basePath, jsonData) => {
if(id !== 'undefined'){
langsMenu[0].link = `/en/${basePath}` + getIdJsonUrl(id, 'en', jsonData) + '/';
langsMenu[1].link = `/it/${basePath}` + getIdJsonUrl(id, 'it', jsonData) + '/';
}else{
console.log("missed id in the setLangsMenu() function!");
}
};

to not add the extra / if the link is the root /it/ or /en/.

from gatsby-starter-i18n-bulma.

kalwalt avatar kalwalt commented on May 24, 2024

I suppose something like this (not tested at all):

const setLangsMenu = ( langsMenu, id, basePath, jsonData) => { 
   if(id !== 'undefined'){
    if (id=='01') {
      langsMenu[0].link = `/en/`;  
      langsMenu[1].link = `/it/`; 
     } else {
        langsMenu[0].link = `/en/${basePath}` + getIdJsonUrl(id, 'en', jsonData) + '/';  
        langsMenu[1].link = `/it/${basePath}` + getIdJsonUrl(id, 'it', jsonData) + '/'; 
     }
  }else{  console.log("missed id in the setLangsMenu() function!");  }
};

from gatsby-starter-i18n-bulma.

kalwalt avatar kalwalt commented on May 24, 2024

@JOduMonT i'm working on this branch https://github.com/kalwalt/gatsby-starter-i18n-bulma/tree/fix-lang-switch if you want to test, it seems that be3a25b fix the issue.

from gatsby-starter-i18n-bulma.

kalwalt avatar kalwalt commented on May 24, 2024

Should be solved with #145, closing for now.

from gatsby-starter-i18n-bulma.

kalwalt avatar kalwalt commented on May 24, 2024

I have tested in different situations and don't completely solve the issue: the solution in the last commit works for the home page but not if you change the page from a page like /artworks to /home it will add an extra /. This happens clicking on the logo. I will open a new issue for this.

from gatsby-starter-i18n-bulma.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.