Skip to content

Commit

Permalink
fix(locale): correctly handle locales with region code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Zörb committed Feb 22, 2022
1 parent bd8427b commit 2a6e504
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 16 deletions.
8 changes: 4 additions & 4 deletions hugo-modules/core/package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"name": "wekit-core",
"version": "1.0.0",
"private": "true",
"private": true,
"description": "[Hugo](https://gohugo.io/) templates and utilities that support [Contentful](https://www.contentful.com/) and/or [Storybook](https://storybook.js.org/) projects.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/jungvonmatt/wekit-core.git"
"url": "git+https://github.com/jungvonmatt/wekit.git"
},
"author": "Ben Zörb",
"license": "MIT",
"bugs": {
"url": "https://github.com/jungvonmatt/wekit-core/issues"
"url": "https://github.com/jungvonmatt/wekit/issues"
},
"homepage": "https://github.com/jungvonmatt/wekit-core#readme",
"homepage": "https://github.com/jungvonmatt/wekit/hugo-modules/core#readme",
"devDependencies": {
"prettier": "^2.5.1",
"prettier-plugin-go-template": "^0.0.11"
Expand Down
2 changes: 1 addition & 1 deletion hugo-modules/core/utils/get-data.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{{ $content_type := .content_type }}
{{ $result := dict }}
{{ $content_dir_array := split site.Params.contentdir "/" }}
{{ $folder := or (index $content_dir_array 1) site.LanguageCode }}
{{ $folder := or (index $content_dir_array 1) site.Language.Lang }}
{{ $data := or (index site.Data $folder) site.Data }}

{{ if and $content_type $entry_id }}
Expand Down
2 changes: 1 addition & 1 deletion hugo-modules/core/utils/get-settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
@example - Go Template
{{ partial "utils/get-settings" }}
*/}}
{{ $data := or (index site.Data site.LanguageCode) dict }}
{{ $data := or (index site.Data site.Language.Lang) dict }}
{{ return or $data.settings dict }}
4 changes: 2 additions & 2 deletions templates/app/config/_default/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ ignoreFiles:
disableHugoGeneratorInject: true
enableRobotsTXT: true
buildDrafts: true
languageCode: en
defaultContentLanguage: en
languageCode: en-us
defaultContentLanguage: en-us
defaultContentLanguageInSubdir: true
sitemap:
changefreq: daily
Expand Down
7 changes: 0 additions & 7 deletions templates/app/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,4 @@ module github.com/jungvonmatt/wekit/templates/app
go 1.17

replace github.com/jungvonmatt/wekit/templates/theme-default => ../../templates/theme-default

replace github.com/jungvonmatt/wekit/hugo-modules/core => ../../hugo-modules/core

require (
github.com/jungvonmatt/wekit-core v0.5.6 // indirect
github.com/jungvonmatt/wekit/hugo-modules/core v0.0.0-00010101000000-000000000000 // indirect
github.com/jungvonmatt/wekit/templates/theme-default v0.0.0-00010101000000-000000000000 // indirect
)
2 changes: 1 addition & 1 deletion templates/app/layouts/_default/baseof.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html lang="{{ .Site.LanguageCode | default "en" }}">
<html lang="{{ (index (split site.LanguageCode "-") 0) | default "en" }}">
<head>
{{ partial "structure/head.html" . }}
</head>
Expand Down

0 comments on commit 2a6e504

Please sign in to comment.