Initial commit

This commit is contained in:
2022-10-18 15:44:29 +03:00
commit 3cfda09ced
18 changed files with 1065 additions and 0 deletions

57
internal/testsfs.go Normal file
View File

@@ -0,0 +1,57 @@
package internal
import (
"io/fs"
"testing/fstest"
"time"
)
var TestFS = fstest.MapFS{
"locales": &fstest.MapFile{Mode: 0777 | fs.ModeDir},
"locales/ru": &fstest.MapFile{Mode: 0777 | fs.ModeDir},
"locales/en": &fstest.MapFile{Mode: 0777 | fs.ModeDir},
"locales/ru/active.json": &fstest.MapFile{
Data: []byte(`[
{
"key": "test",
"description": "Для тестов, не трогать",
"translation": "Тест %s"
},
{
"key": "test plural",
"description": "Для тестов, не трогать",
"plural": {
"other": "всего %d пауков",
"one": "паучок",
"=0": "нет пауков",
"=2": "всего пара пауков"
}
}
]`),
Mode: 0555,
ModTime: time.Now(),
Sys: 1,
},
"locales/en/active.json": &fstest.MapFile{
Data: []byte(`[
{
"key": "test",
"description": "Для тестов, не трогать",
"translation": "Test of the %s"
},
{
"key": "test plural",
"description": "Для тестов, не трогать",
"plural": {
"other": "exactly %d spiders",
"one": "spider",
"=0": "no spiders",
"=2": "just pair of spiders"
}
}
]`),
Mode: 0555,
ModTime: time.Now(),
Sys: 1,
},
}