Diffstat (limited to 'locale')
| -rw-r--r-- | locale/localization.en.yaml | 27 | ||||
| -rw-r--r-- | locale/localization.go | 77 | ||||
| -rw-r--r-- | locale/localization.ru.yaml | 27 |
3 files changed, 0 insertions, 131 deletions
diff --git a/locale/localization.en.yaml b/locale/localization.en.yaml deleted file mode 100644 index e93ab00..0000000 --- a/locale/localization.en.yaml +++ /dev/null @@ -1,27 +0,0 @@ -TagsLabel: 'Tags:' -BlogSearch: - Header: 'Blog Search' - TagsHeader: 'Tags' - OrderByHeader: 'Order by...' - TitleOrdered: 'Title' - ActionDateOrdered: 'Action Date' - PublicationDateOrdered: 'Publication Date' - ChooseAllTags: 'Choose All' -GlobalMap: - Header: 'Global Map' -HomePage: - Header: 'Home Page' - Contacts: 'Contacts' - DidYouKnowThat: 'Did you know, that...' - SidebarDescription: 'Describing the Sidebar' - HomePageDescription: 'Home Page -- where we are right now!' - BlogSearchDescription: 'Blog Search. You can find my travel notes there and, maybe, something else!' - MarkerMapDescription: 'Map with markers of my travel notes -- a convinient way to find an interesting region and find related posts!' - ThemeSwitchDescription: 'Theme Palette lets you change the theme of the site -- there are 2 dark and 2 bright themes currently!' - Hymn1: 'We welcome you to Sayasite!' - Hymn2: "We've been expecting you!" - Hymn3: 'You bring such joy in Sayasite!' - Hymn4: 'No matter where you roam, know our love is true!~' -Metadata: - Published: 'Published' - Action: 'Took place on' diff --git a/locale/localization.go b/locale/localization.go deleted file mode 100644 index 7dbb554..0000000 --- a/locale/localization.go +++ /dev/null @@ -1,77 +0,0 @@ -package locale - -import ( - "os" - - "github.com/go-playground/validator/v10" - "gopkg.in/yaml.v3" -) - -type LocaleConfig struct { - TagsLabel string `yaml:"TagsLabel" json:"TagsLabel"` - BlogSearch BlogSearchConfig `yaml:"BlogSearch" json:"BlogSearch"` - GlobalMap GlobalMapConfig `yaml:"GlobalMap" json:"GlobalMap"` - HomePage HomePageConfig `yaml:"HomePage" json:"HomePage"` - Metadata MetadataConfig `yaml:"Metadata" json:"Metadata"` -} - -type BlogSearchConfig struct { - Header string `yaml:"Header" json:"Header"` - TagsHeader string `yaml:"TagsHeader" json:"TagsHeader"` - OrderByHeader string `yaml:"OrderByHeader" json:"OrderByHeader"` - TitleOrdered string `yaml:"TitleOrdered" json:"TitleOrdered"` - ActionDateOrdered string `yaml:"ActionDateOrdered" json:"ActionDateOrdered"` - PublicationDateOrdered string `yaml:"PublicationDateOrdered" json:"PublicationDateOrdered"` - ChooseAllTags string `yaml:"ChooseAllTags" json:"ChooseAllTags"` -} - -type GlobalMapConfig struct { - Header string `yaml:"Header" json:"Header"` -} - -type HomePageConfig struct { - Header string `yaml:"Header" json:"Header"` - Contacts string `yaml:"Contacts" json:"Contacts"` - DidYouKnowThat string `yaml:"DidYouKnowThat" json:"DidYouKnowThat"` - SidebarDescription string `yaml:"SidebarDescription" json:"SidebarDescription"` - HomePageDescription string `yaml:"HomePageDescription" json:"HomePageDescription"` - BlogSearchDescription string `yaml:"BlogSearchDescription" json:"BlogSearchDescription"` - MarkerMapDescription string `yaml:"MarkerMapDescription" json:"MarkerMapDescription"` - ThemeSwitchDescription string `yaml:"ThemeSwitchDescription" json:"ThemeSwitchDescription"` - Hymn1 string `yaml:"Hymn1" json:"Hymn1"` - Hymn2 string `yaml:"Hymn2" json:"Hymn2"` - Hymn3 string `yaml:"Hymn3" json:"Hymn3"` - Hymn4 string `yaml:"Hymn4" json:"Hymn4"` -} - -type MetadataConfig struct { - Action string `yaml:"Action" json:"Action"` - Published string `yaml:"Published" json:"Published"` -} - -func LoadConfig(path string, config *LocaleConfig) error { - fileBytes, err := os.ReadFile(path) - if err != nil { - return err - } - - if err = yaml.Unmarshal(fileBytes, config); err != nil { - return err - } - - return nil -} - -func InitConfig(path string) (*LocaleConfig, error) { - config := &LocaleConfig{} - if err := LoadConfig(path, config); err != nil { - return nil, err - } - - validate := validator.New(validator.WithRequiredStructEnabled()) - if err := validate.Struct(config); err != nil { - return nil, err - } - - return config, nil -} diff --git a/locale/localization.ru.yaml b/locale/localization.ru.yaml deleted file mode 100644 index a1a9a6c..0000000 --- a/locale/localization.ru.yaml +++ /dev/null @@ -1,27 +0,0 @@ -TagsLabel: 'Тэги:' -BlogSearch: - Header: 'Поиск по блогу' - TagsHeader: 'Тэги' - OrderByHeader: 'Упорядочить по...' - TitleOrdered: 'названию' - ActionDateOrdered: 'дате действия' - PublicationDateOrdered: 'времени публикации' - ChooseAllTags: 'Выбрать все' -GlobalMap: - Header: 'Глобальная карта' -HomePage: - Header: 'Домашняя страница' - Contacts: 'Контакты' - DidYouKnowThat: 'А вы знали, что...' - SidebarDescription: 'Поясняем за сайдбар' - HomePageDescription: 'Домашняя страница -- где мы сейчас и находимся!' - BlogSearchDescription: 'Поиск по блогу. Там размещены мои путевые заметки и, может, что-то ещё!' - MarkerMapDescription: 'Карта с маркерами моих путевых заметок, -- удобный способ найти интересный регион и перейти на заинтересовавшие посты!' - ThemeSwitchDescription: 'Позволяет поменять тему сайта -- есть 2 светлые и 2 тёмные темы!' - Hymn1: 'Приветствуем Вас на Саясайте!' - Hymn2: 'Мы Вас столько ждали!' - Hymn3: 'Столько радости от Вас на Саясайте!' - Hymn4: 'Где бы Вы не были, знайте, -- наша любовь крепка!' -Metadata: - Published: 'Опубликовано' - Action: 'Время действия' |