summaryrefslogtreecommitdiff
path: root/locale
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
Diffstat (limited to 'locale')
-rw-r--r--locale/localization.en.yaml9
-rw-r--r--locale/localization.go50
-rw-r--r--locale/localization.ru.yaml9
3 files changed, 0 insertions, 68 deletions
diff --git a/locale/localization.en.yaml b/locale/localization.en.yaml
deleted file mode 100644
index 879fce8..0000000
--- a/locale/localization.en.yaml
+++ /dev/null
@@ -1,9 +0,0 @@
-TagsLabel: 'Tags:'
-BlogSearch:
- Header: 'Blog Search'
- TagsHeader: 'Tags'
- OrderByHeader: 'Order by...'
- TitleOrdered: 'Title'
- ActionDateOrdered: 'Action Date'
- PublicationDateOrdered: 'Publication Date'
- ChooseAllTags: 'Choose All'
diff --git a/locale/localization.go b/locale/localization.go
deleted file mode 100644
index d5c6b48..0000000
--- a/locale/localization.go
+++ /dev/null
@@ -1,50 +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"`
-}
-
-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"`
-}
-
-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 786665d..0000000
--- a/locale/localization.ru.yaml
+++ /dev/null
@@ -1,9 +0,0 @@
-TagsLabel: 'Тэги:'
-BlogSearch:
- Header: 'Поиск по блогу'
- TagsHeader: 'Тэги'
- OrderByHeader: 'Упорядочить по...'
- TitleOrdered: 'названию'
- ActionDateOrdered: 'дате действия'
- PublicationDateOrdered: 'времени публикации'
- ChooseAllTags: 'Выбрать все'