Skip to content

Commit c0cd663

Browse files
committed
debian: fix fuzz in debian patch
The 0007-i18n-use-dummy-localizations-to-avoid-dependencies patch has some lines "fuzzy" when applied, and that makes fail at least one test (Tests / Package debian-sid-64 / build-deb). This patch fixes it.
1 parent c2e5074 commit c0cd663

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

packaging/debian-sid/patches/0007-i18n-use-dummy-localizations-to-avoid-dependencies.patch

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
1717
2 files changed, 11 insertions(+), 201 deletions(-)
1818

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

@@ -128,11 +128,19 @@ index 352e9a65d3..12885f7149 100644
128128
// NG is the shorthand for NGettext
129129
func NG(msgid string, msgidPlural string, n int) string {
130130
- return locale.NGettext(msgid, msgidPlural, ngn(n))
131+
-}
132+
-
133+
-func MockLocale(l gettext.Catalog) (restore func()) {
134+
- osutil.MustBeTestBinary("cannot mock locale in a non-test binary")
135+
- old := locale
136+
- locale = l
137+
- return func() {
138+
- locale = old
131139
+ if n == 1 {
132140
+ return msgid
133141
+ } else {
134142
+ return msgidPlural
135-
+ }
143+
}
136144
}
137145
diff --git a/i18n/i18n_test.go b/i18n/i18n_test.go
138146
index b8b0b1ea57..86b59f3b43 100644
@@ -286,6 +294,3 @@ index b8b0b1ea57..86b59f3b43 100644
286294
+ c.Assert(NGtest("plural_1", "plural_2", 1), Equals, "plural_1")
287295
+ c.Assert(NGtest("plural_1", "plural_2", 2), Equals, "plural_2")
288296
}
289-
--
290-
2.31.1
291-

0 commit comments

Comments
 (0)