Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tpl
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-07-26 20:04:10 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-09-06 18:32:16 +0300
commit3a02807970e792299a80738befe32eea8d10984d (patch)
treef0886f9bf15e48280ac8bb69e1695831fcff5115 /tpl
parent52bf8f90958e75007ca0a2761edc6ca331ca3280 (diff)
Add Translations and AllTranslations to Node
This commit also consolidates URLs on Node vs Page, so now .Permalink should be interoperable. Note that this implementations should be fairly short-livded, waiting for #2297, but the API should be stable.
Diffstat (limited to 'tpl')
-rw-r--r--tpl/template_i18n.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/tpl/template_i18n.go b/tpl/template_i18n.go
index 5590fe29a..462b30a80 100644
--- a/tpl/template_i18n.go
+++ b/tpl/template_i18n.go
@@ -35,7 +35,8 @@ func SetTranslateLang(lang string) error {
translater.current = f
return nil
}
- return fmt.Errorf("Translation func for language %v not found", lang)
+ jww.WARN.Printf("Translation func for language %v not found", lang)
+ return nil
}
func SetI18nTfuncs(bndl *bundle.Bundle) {
@@ -58,7 +59,7 @@ func SetI18nTfuncs(bndl *bundle.Bundle) {
}
func I18nTranslate(id string, args ...interface{}) (string, error) {
- if translater == nil {
+ if translater == nil || translater.current == nil {
return "", fmt.Errorf("i18n not initialized, have you configured everything properly?")
}
return translater.current(id, args...), nil