diff --git a/catalog_gen.go b/catalog_gen.go index 984d5a3..ea028d5 100644 --- a/catalog_gen.go +++ b/catalog_gen.go @@ -49,20 +49,23 @@ var messageKeyToIndex = map[string]int{ var enIndex = []uint32{ // 7 elements 0x00000000, 0x00000008, 0x00000013, 0x0000002a, - 0x00000046, 0x00000055, 0x00000067, + 0x00000046, 0x00000055, 0x00000092, } // Size: 52 bytes -const enData string = "" + // Size: 103 bytes +const enData string = "" + // Size: 146 bytes "\x02version\x02%[1]s logo\x02Dead simple WebSub hub\x02How to publish an" + - "d consume?\x02What the spec?\x02%[1]d subscribers" + "d consume?\x02What the spec?\x14\x01\x81\x01\x00=\x00\x0f\x02no subscrib" + + "ers=\x01\x0f\x02one subscriber\x00\x12\x02%[1]d subscribers" var ruIndex = []uint32{ // 7 elements 0x00000000, 0x0000000d, 0x00000022, 0x00000045, - 0x0000007a, 0x00000090, 0x000000ad, + 0x0000007a, 0x00000090, 0x00000111, } // Size: 52 bytes -const ruData string = "" + // Size: 173 bytes +const ruData string = "" + // Size: 273 bytes "\x02версия\x02логотип %[1]s\x02Простейший хаб WebSub\x02Как публиковать " + - "и принимать?\x02В чём спека?\x02%[1]d подписчиков" + "и принимать?\x02В чём спека?\x14\x01\x81\x01\x00=\x00\x1e\x02без подпис" + + "чиков=\x01\x1c\x02один подписчик\x04\x1b\x02%[1]d подписчика\x00\x1d" + + "\x02%[1]d подписчиков" - // Total table size 380 bytes (0KiB); checksum: 7D8C2E8B + // Total table size 523 bytes (0KiB); checksum: 6AB3BB61 diff --git a/locales/en/messages.gotext.json b/locales/en/messages.gotext.json new file mode 100644 index 0000000..713da3b --- /dev/null +++ b/locales/en/messages.gotext.json @@ -0,0 +1,83 @@ +{ + "language": "en", + "messages": [ + { + "id": "version", + "message": "version", + "translation": "version", + "translatorComment": "Copied from source.", + "fuzzy": true + }, + { + "id": "{Name} logo", + "message": "{Name} logo", + "translation": "{Name} logo", + "translatorComment": "Copied from source.", + "placeholders": [ + { + "id": "Name", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "p.name" + } + ], + "fuzzy": true + }, + { + "id": "Dead simple WebSub hub", + "message": "Dead simple WebSub hub", + "translation": "Dead simple WebSub hub", + "translatorComment": "Copied from source.", + "fuzzy": true + }, + { + "id": "How to publish and consume?", + "message": "How to publish and consume?", + "translation": "How to publish and consume?", + "translatorComment": "Copied from source.", + "fuzzy": true + }, + { + "id": "What the spec?", + "message": "What the spec?", + "translation": "What the spec?", + "translatorComment": "Copied from source.", + "fuzzy": true + }, + { + "id": "{Subscribers} subscribers", + "message": "{Subscribers} subscribers", + "translation": { + "select": { + "feature": "plural", + "arg": "Subscribers", + "cases": { + "=0": { + "msg": "no subscribers" + }, + "=1": { + "msg": "one subscriber" + }, + "other": { + "msg": "{Subscribers} subscribers" + } + } + } + }, + "translatorComment": "Added plural feature support.", + "placeholders": [ + { + "id": "Subscribers", + "string": "%[1]d", + "type": "int", + "underlyingType": "int", + "argNum": 1, + "expr": "p.Subscribers" + } + ], + "fuzzy": true + } + ] +} diff --git a/locales/en/out.gotext.json b/locales/en/out.gotext.json index 631f9bc..6329648 100644 --- a/locales/en/out.gotext.json +++ b/locales/en/out.gotext.json @@ -49,8 +49,24 @@ { "id": "{Subscribers} subscribers", "message": "{Subscribers} subscribers", - "translation": "{Subscribers} subscribers", - "translatorComment": "Copied from source.", + "translation": { + "select": { + "feature": "plural", + "arg": "Subscribers", + "cases": { + "=0": { + "msg": "no subscribers" + }, + "=1": { + "msg": "one subscriber" + }, + "other": { + "msg": "{Subscribers} subscribers" + } + } + } + }, + "translatorComment": "Added plural feature support.", "placeholders": [ { "id": "Subscribers", diff --git a/locales/ru/messages.gotext.json b/locales/ru/messages.gotext.json index 317461a..e8a5e4c 100644 --- a/locales/ru/messages.gotext.json +++ b/locales/ru/messages.gotext.json @@ -39,7 +39,26 @@ { "id": "{Subscribers} subscribers", "message": "{Subscribers} subscribers", - "translation": "{Subscribers} подписчиков", + "translation": { + "select": { + "feature": "plural", + "arg": "Subscribers", + "cases": { + "=0": { + "msg": "без подписчиков" + }, + "=1": { + "msg": "один подписчик" + }, + "few": { + "msg": "{Subscribers} подписчика" + }, + "other": { + "msg": "{Subscribers} подписчиков" + } + } + } + }, "placeholders": [ { "id": "Subscribers", diff --git a/locales/ru/out.gotext.json b/locales/ru/out.gotext.json index cf73ec4..bafe252 100644 --- a/locales/ru/out.gotext.json +++ b/locales/ru/out.gotext.json @@ -39,7 +39,26 @@ { "id": "{Subscribers} subscribers", "message": "{Subscribers} subscribers", - "translation": "{Subscribers} подписчиков", + "translation": { + "select": { + "feature": "plural", + "arg": "Subscribers", + "cases": { + "=0": { + "msg": "без подписчиков" + }, + "=1": { + "msg": "один подписчик" + }, + "few": { + "msg": "{Subscribers} подписчика" + }, + "other": { + "msg": "{Subscribers} подписчиков" + } + } + } + }, "placeholders": [ { "id": "Subscribers", diff --git a/main.go b/main.go index 212a39d..65e63fd 100644 --- a/main.go +++ b/main.go @@ -16,7 +16,6 @@ import ( "github.com/caarlos0/env/v10" "github.com/jmoiron/sqlx" - "golang.org/x/text/feature/plural" "golang.org/x/text/language" "golang.org/x/text/message" _ "modernc.org/sqlite" @@ -37,23 +36,6 @@ var logger = log.New(os.Stdout, "hub\t", log.LstdFlags) //go:embed web/static/* var static embed.FS -func init() { - message.Set(language.English, "%d subscribers", - plural.Selectf(1, "%d", - "one", "%d subscriber", - "other", "%d subscribers", - ), - ) - message.Set(language.Russian, "%d subscribers", - plural.Selectf(1, "%d", - "one", "%d подписчик", - "few", "%d подписчика", - "many", "%d подписчиков", - "other", "%d подписчика", - ), - ) -} - func main() { ctx := context.Background()