2023-06-19 23:42:47 +02:00
|
|
|
// SPDX-FileCopyrightText: Copyright The Miniflux Authors. All rights reserved.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
2017-11-20 06:10:04 +01:00
|
|
|
|
2023-08-11 04:46:45 +02:00
|
|
|
package locale // import "miniflux.app/v2/internal/locale"
|
2017-11-20 06:10:04 +01:00
|
|
|
|
|
|
|
// See https://localization-guide.readthedocs.io/en/latest/l10n/pluralforms.html
|
|
|
|
// And http://www.unicode.org/cldr/charts/29/supplemental/language_plural_rules.html
|
2024-02-28 16:08:20 +01:00
|
|
|
var pluralForms = map[string](func(n int) int){
|
2017-11-20 06:10:04 +01:00
|
|
|
// nplurals=2; plural=(n != 1);
|
|
|
|
"default": func(n int) int {
|
|
|
|
if n != 1 {
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
},
|
|
|
|
// nplurals=6; plural=(n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5);
|
|
|
|
"ar_AR": func(n int) int {
|
2024-02-28 16:08:20 +01:00
|
|
|
switch {
|
|
|
|
case n == 0:
|
2017-11-20 06:10:04 +01:00
|
|
|
return 0
|
2024-02-28 16:08:20 +01:00
|
|
|
case n == 1:
|
2017-11-20 06:10:04 +01:00
|
|
|
return 1
|
2024-02-28 16:08:20 +01:00
|
|
|
case n == 2:
|
2017-11-20 06:10:04 +01:00
|
|
|
return 2
|
2024-02-28 16:08:20 +01:00
|
|
|
case n%100 >= 3 && n%100 <= 10:
|
2017-11-20 06:10:04 +01:00
|
|
|
return 3
|
2024-02-28 16:08:20 +01:00
|
|
|
case n%100 >= 11:
|
2017-11-20 06:10:04 +01:00
|
|
|
return 4
|
|
|
|
}
|
|
|
|
return 5
|
|
|
|
},
|
|
|
|
// nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;
|
|
|
|
"cs_CZ": func(n int) int {
|
2024-02-28 16:08:20 +01:00
|
|
|
switch {
|
|
|
|
case n == 1:
|
2017-11-20 06:10:04 +01:00
|
|
|
return 0
|
2024-02-28 16:08:20 +01:00
|
|
|
case n >= 2 && n <= 4:
|
2017-11-20 06:10:04 +01:00
|
|
|
return 1
|
|
|
|
}
|
|
|
|
return 2
|
|
|
|
},
|
2024-03-01 05:20:29 +01:00
|
|
|
// nplurals=2; plural=(n > 1);
|
|
|
|
"fr_FR": func(n int) int {
|
|
|
|
if n > 1 {
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
},
|
2023-02-20 02:00:52 +01:00
|
|
|
// nplurals=1; plural=0;
|
|
|
|
"id_ID": func(n int) int {
|
|
|
|
return 0
|
|
|
|
},
|
2024-03-01 05:20:29 +01:00
|
|
|
// nplurals=1; plural=0;
|
|
|
|
"ja_JP": func(n int) int {
|
|
|
|
return 0
|
|
|
|
},
|
2017-11-20 06:10:04 +01:00
|
|
|
// nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);
|
|
|
|
"pl_PL": func(n int) int {
|
2024-02-28 16:08:20 +01:00
|
|
|
switch {
|
|
|
|
case n == 1:
|
2017-11-20 06:10:04 +01:00
|
|
|
return 0
|
2024-02-28 16:08:20 +01:00
|
|
|
case n%10 >= 2 && n%10 <= 4 && (n%100 < 10 || n%100 >= 20):
|
2017-11-20 06:10:04 +01:00
|
|
|
return 1
|
|
|
|
}
|
|
|
|
return 2
|
|
|
|
},
|
|
|
|
// nplurals=2; plural=(n > 1);
|
|
|
|
"pt_BR": func(n int) int {
|
|
|
|
if n > 1 {
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
},
|
2022-08-15 18:13:47 +02:00
|
|
|
"ru_RU": pluralFormRuSrUa,
|
2024-03-01 05:20:29 +01:00
|
|
|
// nplurals=2; plural=(n > 1);
|
|
|
|
"tr_TR": func(n int) int {
|
|
|
|
if n > 1 {
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
},
|
2022-08-15 18:13:47 +02:00
|
|
|
"uk_UA": pluralFormRuSrUa,
|
|
|
|
"sr_RS": pluralFormRuSrUa,
|
2017-11-20 06:10:04 +01:00
|
|
|
// nplurals=1; plural=0;
|
|
|
|
"zh_CN": func(n int) int {
|
|
|
|
return 0
|
|
|
|
},
|
2024-03-01 05:20:29 +01:00
|
|
|
"zh_TW": func(n int) int {
|
|
|
|
return 0
|
|
|
|
},
|
2017-11-20 06:10:04 +01:00
|
|
|
}
|
2022-08-15 18:13:47 +02:00
|
|
|
|
|
|
|
// nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);
|
|
|
|
func pluralFormRuSrUa(n int) int {
|
2024-02-28 16:08:20 +01:00
|
|
|
switch {
|
|
|
|
case n%10 == 1 && n%100 != 11:
|
2022-08-15 18:13:47 +02:00
|
|
|
return 0
|
2024-02-28 16:08:20 +01:00
|
|
|
case n%10 >= 2 && n%10 <= 4 && (n%100 < 10 || n%100 >= 20):
|
2022-08-15 18:13:47 +02:00
|
|
|
return 1
|
|
|
|
}
|
|
|
|
return 2
|
|
|
|
}
|