Open shimizukawa opened 9 years ago
Hello, It would be a great idea to generate builds by language !
I ran into some documentatin that does this - it's not great that they've hardcoded the language list into layout.html, but this does demonstrate that people want to do this, and shows a UI they think works well.
Anyway, the relevant bits of doc source can be found from:
The language switcher itself starts at:
and the rendered docs are at: https://docs.cryptpad.org
From experience contributing one or two small fixes to Debian's documentation projects, I can share how they approach this problem:
PT
and EN
language codes, then index.pt.html
and index.en.html
will co-exist in the combined output dir).index.{__}.html
file based on the user's browser Accept-Language
header; however a default index.html
file (or symlink) is also included in the directory and may be navigated-to directly.There is two obstacles/limitations that I can think of initially:
searchindex.js
-- the search index file -- typically written into each per-language output in the search.html
file from the basic
theme base. Sphinx's search functionality does include localization support (it provides different stemming rules for various languages, for example) - so ideally in the example above we would also produce distinct searchindex.pt.js
and searchindex.en.js
files. This seems to overlap with feature request #11153 about specifying search index filename.en-US
for example). This would hopefully not be a significant problem to overcome in terms of deciding on filename suffixes, but it would be good to determine some preferred mechanisms (for example: is index.en_us.html
the locale-specific filename output? and is index.en.html
also produced, similar to the top-level default of index.html
? I would probably argue that no, the project only has one default (determined by the authors) and that is the index.html
version; the chooser menu and/or the Accept-Language
heading (when a match is available) allow for a more-specific choice to be determined)Edit: reword default-index selection sentence.
Note also: the use of Accept-Language
header on the webserver in the approach above is entirely optional; a simple static webserver will still be able to host the combined multilingual HTML documentation absolutely fine, and users will be able to choose their preferred language. However, the initial/default language they see will be the project default instead of a dynamically-negotiated one determined from the browser settings.
With the translation machinery released in version 1.1 it is a natural idea to generate multiple builds using different languages and create a HTML tree including different languages with the outer pages allowing to switch between them.
It would also be interesting to investigate if this makes any sense with output formats other than HTML.