Add languageDirection to language configuration

Fixes #6550
This commit is contained in:
Tan Yuanhong 2020-03-10 17:10:58 +08:00 committed by GitHub
parent 5b4659fa0b
commit 5914f91b6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 4 deletions

View file

@ -47,6 +47,11 @@ weight = 2
linkedin = "https://linkedin.com/fr/whoever"
[languages.fr.params.navigation]
help = "Aide"
[languages.ar]
title = "مدونتي"
weight = 2
languagedirection = "rtl"
{{< /code-toggle >}}
Anything not defined in a `languages` block will fall back to the global value for that key (e.g., `copyright` for the English `en` language). This also works for `params`, as demonstrated with `help` above: You will get the value `Aide` in French and `Help` in all the languages without this parameter set.

View file

@ -185,6 +185,8 @@ func toSortedLanguages(cfg config.Provider, l map[string]interface{}) (Languages
language.Title = cast.ToString(v)
case "languagename":
language.LanguageName = cast.ToString(v)
case "languagedirection":
language.LanguageDirection = cast.ToString(v)
case "weight":
language.Weight = cast.ToInt(v)
case "contentdir":

View file

@ -41,10 +41,11 @@ var globalOnlySettings = map[string]bool{
// Language manages specific-language configuration.
type Language struct {
Lang string
LanguageName string
Title string
Weight int
Lang string
LanguageName string
LanguageDirection string
Title string
Weight int
Disabled bool