aboutsummaryrefslogtreecommitdiffhomepage
path: root/langs
diff options
context:
space:
mode:
authorJoe Mooring <[email protected]>2021-11-07 07:06:48 -0800
committerBjørn Erik Pedersen <[email protected]>2021-12-02 16:30:53 +0100
commit58adbeef88ea5c8769d12ba27eef2d89bdf575eb (patch)
treea680cf2e48d1c9f59bc55e9be59f7670ed7d801b /langs
parent93572e53181b5a614c2874bd00b7a38a02de58d3 (diff)
downloadhugo-58adbeef88ea5c8769d12ba27eef2d89bdf575eb.tar.gz
hugo-58adbeef88ea5c8769d12ba27eef2d89bdf575eb.zip
Validate private use language tags
Fixes #9119
Diffstat (limited to 'langs')
-rw-r--r--langs/i18n/translationProvider.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/langs/i18n/translationProvider.go b/langs/i18n/translationProvider.go
index 9e82b18d9..44bd52f0c 100644
--- a/langs/i18n/translationProvider.go
+++ b/langs/i18n/translationProvider.go
@@ -93,6 +93,11 @@ func addTranslationFile(bundle *i18n.Bundle, r source.File) error {
lang := paths.Filename(name)
tag := language.Make(lang)
if tag == language.Und {
+ try := artificialLangTagPrefix + lang
+ _, err = language.Parse(try)
+ if err != nil {
+ return _errors.Errorf("%q %s.", try, err)
+ }
name = artificialLangTagPrefix + name
}