summaryrefslogtreecommitdiffci
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.yaml74
-rw-r--r--locale/localization.go139
-rw-r--r--locale/localization.ru.yaml74
3 files changed, 287 insertions, 0 deletions
diff --git a/locale/localization.en.yaml b/locale/localization.en.yaml
new file mode 100644
index 0000000..c7f2df8
--- /dev/null
+++ b/locale/localization.en.yaml
@@ -0,0 +1,74 @@
+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!~'
+UnsubscribePage:
+ Header: 'Cancelling the Subscription'
+ UnsetCode: 'Your cancel code is not set. You just having a walk around the site?'
+ InvalidCode: "Your cancel code could not be verified. Maybe, the code expired after a day. Or maybe, you've already unsubscribed."
+ OnServerError: "We couldn't unsubscribe you, the problem is on our side! We will solve this problem as soon as possible."
+ Success: 'Cancelled your subscription successfully! We do hope we will engage you again someday.'
+Metadata:
+ Published: 'Published'
+ Action: 'Took place on'
+Mail:
+ UnsubscribeFooter: 'If this letter got you in a bad mood, you can unsubscribe from my blog by {}this link{/}.'
+ VerifyEmail:
+ Subject: 'Verification Link for SAYA.TODAY is waiting for you!'
+ Welcome: 'Greetings!'
+ Intro: 'There are 2 ways for us to validate your profile:'
+ GotoLink: 'Go by this link:'
+ InputCode: "Or input this code on the personal page:"
+ IfRandom: 'If you are unsure what this letter this, you can ignore it, and also, if you are interested, you may visit my site :)'
+ NewPost:
+ Subject: 'A new post arrived at SAYA.TODAY!'
+ Intro: 'A new post came!'
+ CapturedOn: 'Captured on'
+UserProfile:
+ Header: 'Personal Settings'
+ EmailHeader: 'E-Mail'
+ VerificationCodeHeader: 'Verification Code'
+ TypeEmail: 'Please type your email'
+ SendCodeButton: 'Send Code'
+ VerifyButton: 'Verify'
+ VerificationCodeSent: 'Verification code sent! Please check your e-mail. Your next verification attempt will be possible on {}.'
+ DelayTilVerification: 'You have already requested the verification before! Please wait until {} for a new verification request.'
+ FailedEmailRender: 'Failed to render the email status message, please ask administrator for a more detailed cause.'
+ VerificationCodeSendingError: 'Failed to send a verification code, please ask administrator for a more detailed cause.'
+ EmailAlreadyValidated: 'You already have this E-Mail validated.'
+ EmailTaken: 'This E-Mail is already taken.'
+ EmailEmpty: 'E-Mail is unset or empty.'
+ VerificationSuccess: 'Success! You are now able to subscribe with your new e-mail.'
+ VerificationFailed: 'Verification code is invalid, please ask administrator for a more detailed cause.'
+ VerificationEmpty: 'Verification code is unset or empty.'
+ SubscriptionHeader: 'Subscribe to...'
+ TagsNone: 'None'
+ TagsAll: 'All'
+ TagsSpecific: 'Specific'
+ TagDoesNotExist: 'The tag "{}" does not exist on the site.'
+ TagAlreadyAdded: 'The tag "{}" is already in your subscribed list.'
+ SaveButton: 'Save'
+ SubscribeInvalidType: 'Invalid subscription type.'
+ FailedToSubscribe: 'Failed to subscribe by new settings, please ask administrator for a more detailed cause.'
+ SubscribedSuccessfully: 'Successfully subscribed you by new settings!'
+ RefreshPage: 'Please refresh the profile page on the device, where you requested the code.'
diff --git a/locale/localization.go b/locale/localization.go
new file mode 100644
index 0000000..c6467c4
--- /dev/null
+++ b/locale/localization.go
@@ -0,0 +1,139 @@
+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"`
+ UnsubscribePage UnsubscribePageConfig `yaml:"UnsubscribePage" json:"UnsubscribePage"`
+ Metadata MetadataConfig `yaml:"Metadata" json:"Metadata"`
+ Mail MailConfig `yaml:"Mail" json:"Mail"`
+ UserProfile UserProfileConfig `yaml:"UserProfile" json:"UserProfile"`
+}
+
+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 UnsubscribePageConfig struct {
+ Header string `yaml:"Header" json:"Header"`
+ UnsetCode string `yaml:"UnsetCode" json:"UnsetCode"`
+ InvalidCode string `yaml:"InvalidCode" json:"InvalidCode"`
+ OnServerError string `yaml:"OnServerError" json:"OnServerError"`
+ Success string `yaml:"Success" json:"Success"`
+}
+
+type MetadataConfig struct {
+ Action string `yaml:"Action" json:"Action"`
+ Published string `yaml:"Published" json:"Published"`
+}
+
+type MailConfig struct {
+ UnsubscribeFooter string `yaml:"UnsubscribeFooter" json:"UnsubscribeFooter"`
+ VerifyEmail VerifyEmailConfig `yaml:"VerifyEmail" json:"VerifyEmail"`
+ NewPost NewPostConfig `yaml:"NewPost" json:"NewPost"`
+}
+
+type VerifyEmailConfig struct {
+ Subject string `yaml:"Subject" json:"Subject"`
+ Welcome string `yaml:"Welcome" json:"Welcome"`
+ Intro string `yaml:"Intro" json:"Intro"`
+ GotoLink string `yaml:"GotoLink" json:"GotoLink"`
+ InputCode string `yaml:"InputCode" json:"InputCode"`
+ IfRandom string `yaml:"IfRandom" json:"IfRandom"`
+}
+
+type NewPostConfig struct {
+ Subject string `yaml:"Subject" json:"Subject"`
+ CapturedOn string `yaml:"CapturedOn" json:"CapturedOn"`
+ Intro string `yaml:"Intro" json:"Intro"`
+}
+
+type UserProfileConfig struct {
+ Header string `yaml:"Header" json:"Header"`
+ EmailHeader string `yaml:"EmailHeader" json:"EmailHeader"`
+ VerificationCodeHeader string `yaml:"VerificationCodeHeader" json:"VerificationCodeHeader"`
+ TypeEmail string `yaml:"TypeEmail" json:"TypeEmail"`
+ SendCodeButton string `yaml:"SendCodeButton" json:"SendCodeButton"`
+ VerifyButton string `yaml:"VerifyButton" json:"VerifyButton"`
+ VerificationCodeSent string `yaml:"VerificationCodeSent" json:"VerificationCodeSent"`
+ DelayTilVerification string `yaml:"DelayTilVerification" json:"DelayTilVerification"`
+ FailedEmailRender string `yaml:"FailedEmailRender" json:"FailedEmailRender"`
+ VerificationCodeSendingError string `yaml:"VerificationCodeSendingError" json:"VerificationCodeSendingError"`
+ EmailAlreadyValidated string `yaml:"EmailAlreadyValidated" json:"EmailAlreadyValidated"`
+ EmailTaken string `yaml:"EmailTaken" json:"EmailTaken"`
+ EmailEmpty string `yaml:"EmailEmpty" json:"EmailEmpty"`
+ VerificationSuccess string `yaml:"VerificationSuccess" json:"VerificationSuccess"`
+ VerificationFailed string `yaml:"VerificationFailed" json:"VerificationFailed"`
+ VerificationEmpty string `yaml:"VerificationEmpty" json:"VerificationEmpty"`
+ SubscriptionHeader string `yaml:"SubscriptionHeader" json:"SubscriptionHeader"`
+ TagsNone string `yaml:"TagsNone" json:"TagsNone"`
+ TagsAll string `yaml:"TagsAll" json:"TagsAll"`
+ TagsSpecific string `yaml:"TagsSpecific" json:"TagsSpecific"`
+ TagDoesNotExist string `yaml:"TagDoesNotExist" json:"TagDoesNotExist"`
+ TagAlreadyAdded string `yaml:"TagAlreadyAdded" json:"TagAlreadyAdded"`
+ SaveButton string `yaml:"SaveButton" json:"SaveButton"`
+ SubscribeInvalidType string `yaml:"SubscribeInvalidType" json:"SubscribeInvalidType"`
+ FailedToSubscribe string `yaml:"FailedToSubscribe" json:"FailedToSubscribe"`
+ SubscribedSuccessfully string `yaml:"SubscribedSuccessfully" json:"SubscribedSuccessfully"`
+ RefreshPage string `yaml:"RefreshPage" json:"RefreshPage"`
+}
+
+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
new file mode 100644
index 0000000..5df82da
--- /dev/null
+++ b/locale/localization.ru.yaml
@@ -0,0 +1,74 @@
+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: 'Где бы Вы не были, знайте, -- наша любовь крепка!'
+UnsubscribePage:
+ Header: 'Отписка'
+ UnsetCode: 'Код для отписки не проставлен. Вы случайно не заблудились?'
+ InvalidCode: 'Код для отписки не подтверждён. Может, истекло время в сутки для кода. А может, вы уже успели отписаться.'
+ OnServerError: 'Мы не смогли вас отписать, проблема на нашей стороне! В скором времени займёмся проблемой.'
+ Success: 'Вы отписались от рассылки! Надеюсь, мы ещё сможем вас заинтересовать.'
+Metadata:
+ Published: 'Опубликовано'
+ Action: 'Время действия'
+Mail:
+ UnsubscribeFooter: 'Если данное письмо пришло вам случайно, либо вы хотите отписаться, можете перейти по {}этой ссылке{/}.'
+ VerifyEmail:
+ Subject: 'Ссылка для верификации для подтверждения вашей почты SAYA.TODAY'
+ Welcome: 'Приветствую!'
+ Intro: 'Есть 2 способа, чтобы подтвердить свою электронную почту:'
+ GotoLink: 'Перейти по этой ссылке:'
+ InputCode: 'Либо ввести этот код на странице подписок:'
+ IfRandom: 'Если ты не понимаешь, что это за спам, можешь проигнорировать это письмо, а ещё, если интересно, можешь посетить мой сайт :)'
+ NewPost:
+ Subject: 'Новый пост на SAYA.TODAY!'
+ Intro: 'Вышел новый пост!'
+ CapturedOn: 'Снималось'
+UserProfile:
+ Header: 'Личные настройки'
+ EmailHeader: 'E-Mail'
+ VerificationCodeHeader: 'Код верификации'
+ TypeEmail: 'Пожалуйста, введите свою почту'
+ SendCodeButton: 'Отправить код'
+ VerifyButton: 'Верифицировать'
+ VerificationCodeSent: 'Выслали вам код верификации! Проверьте свою почту. Следующая попытка верификации будет возможна {}.'
+ DelayTilVerification: 'Вы уже запрашивали недавно верификацию! Дождитесь {} для новой попытки.'
+ FailedEmailRender: 'Неудачная попытка создать электронное письмо, более подробно спрашивайте у администратора.'
+ VerificationCodeSendingError: 'Неудачная попытка прислать код для верификации, более подробно спрашивайте у администратора.'
+ EmailAlreadyValidated: 'Эту почту вы уже подтверждали.'
+ EmailTaken: 'Эта почта уже занята.'
+ EmailEmpty: 'Почта не введена.'
+ VerificationSuccess: 'Поздравляем! Теперь по этой почте можно подписаться на блог.'
+ VerificationFailed: 'Код для верификации невалиден, при вопросах, пожалуйста, обращайтесь к администратору.'
+ VerificationEmpty: 'Код для верификации не введён.'
+ SubscriptionHeader: 'Подписаться на...'
+ TagsNone: 'Ничего'
+ TagsAll: 'Всё'
+ TagsSpecific: 'Определённое'
+ TagDoesNotExist: 'Тэга "{}" нет на сайте.'
+ TagAlreadyAdded: 'Тэг "{}" уже у вас добавлен.'
+ SaveButton: 'Сохранить'
+ SubscribeInvalidType: 'Неизвестный тип подписки.'
+ FailedToSubscribe: 'Неудачная попытка записать новую подписку, более подробно спрашивайте у администратора.'
+ SubscribedSuccessfully: 'Вы успешно подписались по новым настройкам!'
+ RefreshPage: 'Пожалуйста, обновите страницу с профилем на устройстве, откуда запрашивали код.'