shithub: hugo

Download patch

ref: 5914f91b6c980e42693661d5fd5640e237691df6
parent: 5b4659fa0bd28511b8aded64e824e73baaabb0b5
author: Tan Yuanhong <leotan.yh@gmail.com>
date: Tue Mar 10 13:10:58 EDT 2020

Add languageDirection to language configuration

Fixes #6550

--- a/docs/content/en/content-management/multilingual.md
+++ b/docs/content/en/content-management/multilingual.md
@@ -47,6 +47,11 @@
 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.
--- a/langs/config.go
+++ b/langs/config.go
@@ -185,6 +185,8 @@
 				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":
--- a/langs/language.go
+++ b/langs/language.go
@@ -41,10 +41,11 @@
 
 // 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