Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Option to write the default locale to a subdirectory also. #60
The webserver should be able to render the appropriate language based on the clients
We are currently internationalizing the F-Droid website using polyglot. After chatting to the folks at Apache, we took our inspiration from the way in which the Apache webserver documentation translates their site and renders the correct language automatically to the user using content negotiation.
Here is their config for reference.
Required webroot layout
For the purpose of connecting Apache
Of course the webroot here is now empty, but then we run a script which iterates over each language directory, and outputs the following:
Where the top level
In order to prevent the
languages: [ "en", "ast", "bo", "de", "es", "es_AR", "fa", "fr", "sc", "tr", "zh_Hans", "zh_Hant" ] default_lang: "None. This forces jekyll polyglot to generate a en/ subdirectory too (with correct links)."
Originally I tried iterating over each file in
Using that workaround, do you notice any problems? The way polyglot is designed,
I would suggest you keep using that workaround. It makes sense to me that it gets the job done effectively.
In the future if our script that writes out typemaps becomes unmaintainable, I might see about submitting a PR which includes a config option to generate Apache2 mod_negotiation TypeMaps in the webroot. But that is a story for another day and out of scope of this issue.
referenced this issue
Jun 27, 2017
Okay, so after continuing experimentation with our site, I've come across a bit of a blocker for the approach I outlined above. If I mark a file/directory as
I thought I'd toy with the idea of a PR which still writes these files to the webroot, but it isn't something which I can see how to do cleanly. Specifically, with my "no
Hmm, now I think about it, perhaps this would work:
I'd be happy to prepare a MR with this functionality. However, note that it may seem strange to users who don't realise that it is a requirement for people wanting to use Apache2 + mod_negotiation in the way that we (and the Apache2 folks themselves) are using it.
Does this seem sane and worthy of a PR?