Fallback Po's missing plural translation using plural forms when available. Use western rule n==1 convention only on Locale object without Domain. Fixes #34
This commit is contained in:
8
po.go
8
po.go
@@ -365,7 +365,7 @@ func (po *Po) pluralForm(n int) int {
|
||||
|
||||
// Failure fallback
|
||||
if po.pluralforms == nil {
|
||||
/* Use the Germanic plural rule. */
|
||||
/* Use Western plural rule. */
|
||||
if n == 1 {
|
||||
return 0
|
||||
}
|
||||
@@ -404,7 +404,8 @@ func (po *Po) GetN(str, plural string, n int, vars ...interface{}) string {
|
||||
}
|
||||
}
|
||||
|
||||
if n == 1 {
|
||||
// Parse plural forms to distinguish between plural and singular
|
||||
if po.pluralForm(n) == 0 {
|
||||
return Printf(str, vars...)
|
||||
}
|
||||
return Printf(plural, vars...)
|
||||
@@ -448,7 +449,8 @@ func (po *Po) GetNC(str, plural string, n int, ctx string, vars ...interface{})
|
||||
}
|
||||
}
|
||||
|
||||
if n == 1 {
|
||||
// Parse plural forms to distinguish between plural and singular
|
||||
if po.pluralForm(n) == 0 {
|
||||
return Printf(str, vars...)
|
||||
}
|
||||
return Printf(plural, vars...)
|
||||
|
||||
Reference in New Issue
Block a user