hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 5914f91b6c980e42693661d5fd5640e237691df6
parent 5b4659fa0bd28511b8aded64e824e73baaabb0b5
Author: Tan Yuanhong <leotan.yh@gmail.com>
Date:   Tue, 10 Mar 2020 17:10:58 +0800

Add languageDirection to language configuration

Fixes #6550
Diffstat:
Mdocs/content/en/content-management/multilingual.md | 5+++++
Mlangs/config.go | 2++
Mlangs/language.go | 9+++++----
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/docs/content/en/content-management/multilingual.md b/docs/content/en/content-management/multilingual.md
@@ -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.
diff --git a/langs/config.go b/langs/config.go
@@ -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":
diff --git a/langs/language.go b/langs/language.go
@@ -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