ref: cce49997a4f272b508ee98b83d40b087d0acf9e3
parent: 3dd949d956390478da83b44488b0a5f4a9ebeb86
author: Albert Nigmatzianov <albertnigma@gmail.com>
date: Wed May 3 05:11:25 EDT 2017
i18n: Add tests
--- a/i18n/i18n_test.go
+++ b/i18n/i18n_test.go
@@ -64,7 +64,7 @@
// Translation missing in default language but present in current
{ data: map[string][]byte{- "en.toml": []byte("[goodybe]\nother = \"Goodbye, World!\""),+ "en.toml": []byte("[goodbye]\nother = \"Goodbye, World!\""), "es.toml": []byte("[hello]\nother = \"¡Hola, Mundo!\""),},
args: nil,
@@ -111,6 +111,31 @@
id: "wordCount",
expected: "¡Hola, 50 gente!",
expectedFlag: "¡Hola, 50 gente!",
+ },
+ // Same id and translation in current language
+ // https://github.com/spf13/hugo/issues/2607
+ {+ data: map[string][]byte{+ "es.toml": []byte("[hello]\nother = \"hello\""),+ "en.toml": []byte("[hello]\nother = \"hi\""),+ },
+ args: nil,
+ lang: "es",
+ id: "hello",
+ expected: "hello",
+ expectedFlag: "hello",
+ },
+ // Translation missing in current language, but same id and translation in default
+ {+ data: map[string][]byte{+ "es.toml": []byte("[bye]\nother = \"bye\""),+ "en.toml": []byte("[hello]\nother = \"hello\""),+ },
+ args: nil,
+ lang: "es",
+ id: "hello",
+ expected: "hello",
+ expectedFlag: "[i18n] hello",
},
}
--
⑨