Giter Club home page Giter Club logo

Comments (4)

notabeatle avatar notabeatle commented on June 28, 2024

Dropped in a PR for changes that make this behave the way I expected it to. I tried some other things to see if it broke anything, and didn't find any issues, but of course didn't try every possible combination of settings. Notably I'm not set up to easily test that I didn't mess up subdirectory-based translation redirection, somehow, though I think I've not done anything that should affect that. Didn't see any automated tests to run so I just poked at things I thought might have been messed up by these changes, and didn't find anything.

from nlingual.

dougwollison avatar dougwollison commented on June 28, 2024

Will take a look; been juggling a few too many rush projects at work.

It is indeed an issue but it's also arguably a limitation that should be expressed better by the settings. I don't want to prevent someone who's browser language is, say, french, from being able to view the site in english for whatever reason. This could always be overwritten with a GET arg on the URLs of course. I may have even fixed this partially on one of the other branches I've yet to merge (recent development has been a bit... chaotic).

Until I'm able to publish a semi-thorough patch, you should be able to use the available hooks to make the changes you want.

from nlingual.

notabeatle avatar notabeatle commented on June 28, 2024

Cool, thanks for the response! More details about the exact issue in the PR, let me know if you have any questions about it. Meanwhile, I'll look at a hook-based workaround, as suggested.

from nlingual.

dougwollison avatar dougwollison commented on June 28, 2024

Hey, finally had some time to look at this in detail, working on a patch soon that should solve this sanely.

Basically, I've rewritten the handling of skip_default_l10n to not apply when the browser's language matches a non-default supported language. This allows, for example, a french visitor to be redirected to the french page (unless post_language_override is set, it takes precedence), but if they want to they can view the english pages by visting URLs with /en/ specified (or en.* in the case of subdomain handling... which come to think of it I almost never test).

I'm not sure that made sense so here's an outline of scenarios for an english/french site:

Visitor Language Requested URL Redirected URL
English / /
French / /fr/
English /en/ /
French /en/ /en/
English /about/ /about/
French /about/ /fr/a-propos/
English /en/about/ /about/
French /en/about/ /en/about/

I've gotta test it on a few dev sites to make sure first. Should have this ironed out into a proper update next week, provided a certain project doesn't spontaneously return from limbo.

from nlingual.

Related Issues (9)

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.