Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2 files changed, 11 insertions(+), 201 deletions(-)

diff --git a/i18n/i18n.go b/i18n/i18n.go
index 352e9a65d3..12885f7149 100644
index 02a65905c5..12885f7149 100644
--- a/i18n/i18n.go
+++ b/i18n/i18n.go
@@ -19,76 +19,11 @@
Expand Down Expand Up @@ -97,7 +97,7 @@ index 352e9a65d3..12885f7149 100644
func simplifyLocale(loc string) string {
// de_DE.UTF-8, de_DE@euro all need to get simplified
loc = strings.Split(loc, "@")[0]
@@ -106,30 +41,20 @@ func localeFromEnv() string {
@@ -106,39 +41,20 @@ func localeFromEnv() string {
return loc
}

Expand Down Expand Up @@ -128,11 +128,19 @@ index 352e9a65d3..12885f7149 100644
// NG is the shorthand for NGettext
func NG(msgid string, msgidPlural string, n int) string {
- return locale.NGettext(msgid, msgidPlural, ngn(n))
-}
-
-func MockLocale(l gettext.Catalog) (restore func()) {
- osutil.MustBeTestBinary("cannot mock locale in a non-test binary")
- old := locale
- locale = l
- return func() {
- locale = old
+ if n == 1 {
+ return msgid
+ } else {
+ return msgidPlural
+ }
}
}
diff --git a/i18n/i18n_test.go b/i18n/i18n_test.go
index b8b0b1ea57..86b59f3b43 100644
Expand Down Expand Up @@ -286,6 +294,3 @@ index b8b0b1ea57..86b59f3b43 100644
+ c.Assert(NGtest("plural_1", "plural_2", 1), Equals, "plural_1")
+ c.Assert(NGtest("plural_1", "plural_2", 2), Equals, "plural_2")
}
--
2.31.1

Loading