Added support for Hugo Multilingual Mode #55
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I added support for both English and French languages. I've followed Hugo's official documentation on multilingual mode closely to implement these changes. However, please feel free to review and provide feedback, as there's always a chance I might have overlooked something or made some typos.
More languages can be added in the
config.toml
file. The default language is set to English, and you can access the different languages with the URL (for example, the/about
page is in English, but/fr/about
page is in french).Template text translation is done through the
i18n
function, which can be shorten by simply writingT
. This uses thei18n/en.toml
andi18n/fr.toml
translation files (a list of key/value pairs). See this page for more information.The
content
directory now contains two directoriesen
andfr
, in which the Markdown content is manually translated.Here are some steps to add a new language :
config.toml
by adding it under the[languages]
and defining thecontentDir
,languageCode
,languageName
andweight
i18n/fr.toml
). You can use the English file as a basecontent/fr/
). You can use the English directory as a baseThis marks my first open source contribution, and I'm eager to learn and improve.