2024-01-31 21:02:12 +06:00
|
|
|
package localizer
|
|
|
|
|
|
|
|
import (
|
2024-02-04 21:00:55 +06:00
|
|
|
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/src/setting"
|
2024-01-31 21:02:12 +06:00
|
|
|
)
|
|
|
|
|
|
|
|
type RepositoryContract interface {
|
|
|
|
GetCode() (string, error)
|
|
|
|
Save(code string) (setting.Setting, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type Repository struct {
|
|
|
|
settingRepository setting.RepositoryContract
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewRepository(settingRepository setting.RepositoryContract) *Repository {
|
|
|
|
return &Repository{settingRepository: settingRepository}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r Repository) GetCode() (string, error) {
|
|
|
|
return r.settingRepository.GetValue("language")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r Repository) Save(code string) (setting.Setting, error) {
|
|
|
|
return r.settingRepository.CreateOrUpdate("language", code)
|
|
|
|
}
|