-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finish the multilingual feature #2303
Commits on Aug 20, 2016
-
Add multilingual support in Hugo
Implements: * support to render: * content/post/whatever.en.md to /en/2015/12/22/whatever/index.html * content/post/whatever.fr.md to /fr/2015/12/22/whatever/index.html * gets enabled when `Multilingual:` is specified in config. * support having language switchers in templates, that know where the translated page is (with .Page.Translations) (when you're on /en/about/, you can have a "Francais" link pointing to /fr/a-propos/) * all translations are in the `.Page.Translations` map, including the current one. * easily tweak themes to support Multilingual mode * renders in a single swift, no need for two config files. Adds a couple of variables useful for multilingual sites Adds documentation (content/multilingual.md) Added language prefixing for all URL generation/permalinking see in the code base. Implements i18n. Leverages the great github.com/nicksnyder/go-i18n lib.. thanks Nick. * Adds "i18n" and "T" template functions..
Configuration menu - View commit details
-
Copy full SHA for 132035a - Browse repository at this point
Copy the full SHA 132035aView commit details -
Configuration menu - View commit details
-
Copy full SHA for ab69f6d - Browse repository at this point
Copy the full SHA ab69f6dView commit details -
Add Translations and AllTranslations methods to Page
Will revisit Node later.
Configuration menu - View commit details
-
Copy full SHA for ace89dc - Browse repository at this point
Copy the full SHA ace89dcView commit details -
Having many *main* sites doesn't make much sense.
Configuration menu - View commit details
-
Copy full SHA for 45368b1 - Browse repository at this point
Copy the full SHA 45368b1View commit details -
Reset translation slice on rebuild
Also add all translations, including the current, to the slice. We filter later.
Configuration menu - View commit details
-
Copy full SHA for ee608e3 - Browse repository at this point
Copy the full SHA ee608e3View commit details -
And a Hugo global variable which contains the site under build. This is really needed to get some level of control of the "multiple languages" in play. There are still work related to this scattered around, but that will come. With this commit, the multilingual feature is starting to work.
Configuration menu - View commit details
-
Copy full SHA for 57137dd - Browse repository at this point
Copy the full SHA 57137ddView commit details -
Rework the i18n template func handling
Setting the language to use when loading the language bundles just doesn't work. The template system is unfortanetely a global, and the last languate processed won ...
Configuration menu - View commit details
-
Copy full SHA for 0cd90de - Browse repository at this point
Copy the full SHA 0cd90deView commit details -
Add Translations and AllTranslations to Node
This commit also consolidates URLs on Node vs Page, so now .Permalink should be interoperable. Note that this implementations should be fairly short-livded, waiting for #2297, but the API should be stable.
Configuration menu - View commit details
-
Copy full SHA for a414c0b - Browse repository at this point
Copy the full SHA a414c0bView commit details -
It will get more involved in the build process in a minute. See #2309
Configuration menu - View commit details
-
Copy full SHA for b9e234e - Browse repository at this point
Copy the full SHA b9e234eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5101f14 - Browse repository at this point
Copy the full SHA 5101f14View commit details -
Optimize the multilanguage build process
Work In Progress! This commit makes a rework of the build and rebuild process to better suit a multi-site setup. This also includes a complete overhaul of the site tests. Previous these were a messy mix that were testing just small parts of the build chain, some of it testing code-paths not even used in "real life". Now all tests that depends on a built site follows the same and real production code path. See #2309 Closes #2211 Closes #477 Closes #1744
Configuration menu - View commit details
-
Copy full SHA for e7efd95 - Browse repository at this point
Copy the full SHA e7efd95View commit details -
Render the shortcodes as late as possible
This is needed to make shortcode users happy with the new multilanguage support, but it will also solve many other related posts about "stuff not available in the shortcode". We will have to revisit this re the handler chain at some point, but that will be easier now as the integration test story has improved so much. As part of this commit, the site-building tests in page_test.go is refreshed, they now tests for all the rendering engines (when available), and all of them now uses the same code-path as used in production. Fixes #1229 Fixes #2323 Fixes ##1076
Configuration menu - View commit details
-
Copy full SHA for fa30293 - Browse repository at this point
Copy the full SHA fa30293View commit details -
And in the same go adjusted some minor parts of the language API: Add LanguagePrefix alias to Node and rename the Multilingual config section to Languages. See #2309
Configuration menu - View commit details
-
Copy full SHA for a875e2d - Browse repository at this point
Copy the full SHA a875e2dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 31b31ac - Browse repository at this point
Copy the full SHA 31b31acView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0cee248 - Browse repository at this point
Copy the full SHA 0cee248View commit details -
Make the config loading testable
This is needed to verify #2309, but it closes a big hole in Hugo's automated tests. The loading of the config is now moved to `hugolib` and the same default settings are now used in production and tests. As Viper now uses Afero as its filesystem, we now can write fairly complete integration tests with ease. See #2309
Configuration menu - View commit details
-
Copy full SHA for df2a13f - Browse repository at this point
Copy the full SHA df2a13fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0cb0ed9 - Browse repository at this point
Copy the full SHA 0cb0ed9View commit details -
Get the list commands up to multi-site level
This commit also unexports some Site methods, making it clear what the external build API really is. See #2312
Configuration menu - View commit details
-
Copy full SHA for 01cf48f - Browse repository at this point
Copy the full SHA 01cf48fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 34b19ba - Browse repository at this point
Copy the full SHA 34b19baView commit details -
Configuration menu - View commit details
-
Copy full SHA for 29ccd24 - Browse repository at this point
Copy the full SHA 29ccd24View commit details -
Configuration menu - View commit details
-
Copy full SHA for d8e0497 - Browse repository at this point
Copy the full SHA d8e0497View commit details -
Improve language handling in URLs
The current "rendering language" is needed outside of Site. This commit moves the Language type to the helpers package, and then used to get correct correct language configuration in the markdownify template func. This commit also adds two new template funcs: relLangURL and absLangURL. See #2309
Configuration menu - View commit details
-
Copy full SHA for b00623f - Browse repository at this point
Copy the full SHA b00623fView commit details -
Configuration menu - View commit details
-
Copy full SHA for eee1132 - Browse repository at this point
Copy the full SHA eee1132View commit details -
Configuration menu - View commit details
-
Copy full SHA for cfebc29 - Browse repository at this point
Copy the full SHA cfebc29View commit details -
Fix some corner cases in revised summary handling
And clean up the test. See #2309
Configuration menu - View commit details
-
Copy full SHA for 5182241 - Browse repository at this point
Copy the full SHA 5182241View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3037b2d - Browse repository at this point
Copy the full SHA 3037b2dView commit details -
Configuration menu - View commit details
-
Copy full SHA for d9bcbe6 - Browse repository at this point
Copy the full SHA d9bcbe6View commit details -
Make the check command work in multilingual mode
Or: some more multilingual TODO-fixes. See #2309
Configuration menu - View commit details
-
Copy full SHA for e7f0e3a - Browse repository at this point
Copy the full SHA e7f0e3aView commit details -
And pull up common member vars like Tmpl and Multilinguage. Or: the final multilingual TODO-fixes. See #2309
Configuration menu - View commit details
-
Copy full SHA for f42fc56 - Browse repository at this point
Copy the full SHA f42fc56View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5fa9d17 - Browse repository at this point
Copy the full SHA 5fa9d17View commit details -
* Fall back to default language on missing translation file * Add a i18n-warnings build flag * If that flag is set, print a parseable and greppable string on missing translation strings See #2303
Configuration menu - View commit details
-
Copy full SHA for ae6a4fa - Browse repository at this point
Copy the full SHA ae6a4faView commit details -
Configuration menu - View commit details
-
Copy full SHA for b7a922c - Browse repository at this point
Copy the full SHA b7a922cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1767750 - Browse repository at this point
Copy the full SHA 1767750View commit details -
Configuration menu - View commit details
-
Copy full SHA for b3ecfcd - Browse repository at this point
Copy the full SHA b3ecfcdView commit details -
Configuration menu - View commit details
-
Copy full SHA for d8291b7 - Browse repository at this point
Copy the full SHA d8291b7View commit details -
Create a Node map to get proper node translations
In a multi-language setup, before this commit the Node's Translations() method would return some "dummy nodes" that would point to the correct page (Permalink), but would not be the same as the node it points to -- it would not have the translated title etc. The node creation is, however, so mingled with rendering, whihc is too early to have any global state, so the nodes has to be split in a prepare and a render phase. This commits does that with as small a change as possible. This implementation is a temp solution until we fix #2297. Updates #2309
Configuration menu - View commit details
-
Copy full SHA for 1dc571b - Browse repository at this point
Copy the full SHA 1dc571bView commit details -
Add temp MULTILINGUAL version suffix to this branch
For people having trouble building this. Now `hugo version` should print something like: ``` Hugo Static Site Generator v0.17-MULTILINGUAL BuildDate: 2016-08-10T08:20:36+02:00 ```
Configuration menu - View commit details
-
Copy full SHA for 3dd112e - Browse repository at this point
Copy the full SHA 3dd112eView commit details -
Configuration menu - View commit details
-
Copy full SHA for b54f2ff - Browse repository at this point
Copy the full SHA b54f2ffView commit details -
Fix YAML loading of multilingual config
And some other minor fixes from code review. Updates #2309
Configuration menu - View commit details
-
Copy full SHA for a1b2d47 - Browse repository at this point
Copy the full SHA a1b2d47View commit details -
Configuration menu - View commit details
-
Copy full SHA for e0a2715 - Browse repository at this point
Copy the full SHA e0a2715View commit details -
Configuration menu - View commit details
-
Copy full SHA for 949d8b4 - Browse repository at this point
Copy the full SHA 949d8b4View commit details -
Configuration menu - View commit details
-
Copy full SHA for b7c1d5c - Browse repository at this point
Copy the full SHA b7c1d5cView commit details -
Create a copy of the section node for RSS
So the Permalink gets correct when listing translations. I have also checked the other relevant places to make sure we do not overwrite node values we need later. Pointers can be tricky, but lesson learned is: A copy is cheap. Updates #2309
Configuration menu - View commit details
-
Copy full SHA for 3834927 - Browse repository at this point
Copy the full SHA 3834927View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5af4bc1 - Browse repository at this point
Copy the full SHA 5af4bc1View commit details -
Small adjustment to SiteInfo init
After a visual inspection to make (pretty) sure it is correct re multiple languages. Updates #2309
Configuration menu - View commit details
-
Copy full SHA for 5b41d8f - Browse repository at this point
Copy the full SHA 5b41d8fView commit details -
Set lang template globals for each site when render shortcodes
We should get rid of these globals, but that is another month.
Configuration menu - View commit details
-
Copy full SHA for d93a863 - Browse repository at this point
Copy the full SHA d93a863View commit details -
Fix multilingual reload when shortcode changes
This commit also refines the partial rebuild logic, to make sure we do not do more work than needed. Updates #2309
Configuration menu - View commit details
-
Copy full SHA for 7f2871b - Browse repository at this point
Copy the full SHA 7f2871bView commit details -
Configuration menu - View commit details
-
Copy full SHA for a5ed858 - Browse repository at this point
Copy the full SHA a5ed858View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9dd7ac2 - Browse repository at this point
Copy the full SHA 9dd7ac2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5c98048 - Browse repository at this point
Copy the full SHA 5c98048View commit details -
Configuration menu - View commit details
-
Copy full SHA for 680636c - Browse repository at this point
Copy the full SHA 680636cView commit details