summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTan Yuanhong <leotan.yh@gmail.com>2020-03-10 17:10:58 +0800
committerGitHub <noreply@github.com>2020-03-10 10:10:58 +0100
commit5914f91b6c980e42693661d5fd5640e237691df6 (patch)
treebce51813806dc2c96ce41b9df75fad973fe7ee62
parent5b4659fa0bd28511b8aded64e824e73baaabb0b5 (diff)
Add languageDirection to language configuration
Fixes #6550
-rw-r--r--docs/content/en/content-management/multilingual.md5
-rw-r--r--langs/config.go2
-rw-r--r--langs/language.go9
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
index d3f71676a..575393d47 100644
--- 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
index 184223650..08cd15009 100644
--- 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
index 036f5413a..874bd3020 100644
--- 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