Skip to content

Commit

Permalink
Add languageDirection to language configuration
Browse files Browse the repository at this point in the history
Fixes #6550
  • Loading branch information
le0tan authored Mar 10, 2020
1 parent 5b4659f commit 5914f91
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions docs/content/en/content-management/multilingual.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions langs/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
9 changes: 5 additions & 4 deletions langs/language.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 5914f91

Please sign in to comment.