2017-11-20 00:10:04 -05:00
|
|
|
// Copyright 2017 Frédéric Guillot. All rights reserved.
|
|
|
|
// Use of this source code is governed by the Apache 2.0
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package locale
|
|
|
|
|
2017-12-15 21:55:57 -05:00
|
|
|
import "github.com/miniflux/miniflux/logger"
|
2017-11-20 00:10:04 -05:00
|
|
|
|
2017-11-25 18:56:44 -05:00
|
|
|
// Translation is the translation mapping table.
|
2017-11-20 00:10:04 -05:00
|
|
|
type Translation map[string]interface{}
|
|
|
|
|
2017-11-25 18:56:44 -05:00
|
|
|
// Locales represents locales supported by the system.
|
2017-11-20 00:10:04 -05:00
|
|
|
type Locales map[string]Translation
|
|
|
|
|
2017-11-25 18:56:44 -05:00
|
|
|
// Load prepare the locale system by loading all translations.
|
2017-11-20 00:10:04 -05:00
|
|
|
func Load() *Translator {
|
|
|
|
translator := NewTranslator()
|
|
|
|
|
2017-11-25 18:56:44 -05:00
|
|
|
for language, tr := range translations {
|
2017-12-15 21:55:57 -05:00
|
|
|
logger.Debug("Loading translation: %s", language)
|
2017-11-25 18:56:44 -05:00
|
|
|
translator.AddLanguage(language, tr)
|
2017-11-20 00:10:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return translator
|
|
|
|
}
|
|
|
|
|
2017-11-28 00:30:04 -05:00
|
|
|
// AvailableLanguages returns the list of available languages.
|
|
|
|
func AvailableLanguages() map[string]string {
|
2017-11-20 00:10:04 -05:00
|
|
|
return map[string]string{
|
|
|
|
"en_US": "English",
|
|
|
|
"fr_FR": "Français",
|
2018-01-15 20:23:47 -05:00
|
|
|
"de_DE": "Deutsch",
|
2018-02-17 14:29:14 -05:00
|
|
|
"pl_PL": "Polski",
|
2018-02-27 01:36:07 -05:00
|
|
|
"zh_CN": "简体中文",
|
2017-11-20 00:10:04 -05:00
|
|
|
}
|
|
|
|
}
|