locale.go 989 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright 2017 Frédéric Guillot. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. package locale // import "miniflux.app/locale"
  5. import "miniflux.app/logger"
  6. // Translation is the translation mapping table.
  7. type Translation map[string]interface{}
  8. // Locales represents locales supported by the system.
  9. type Locales map[string]Translation
  10. // Load prepare the locale system by loading all translations.
  11. func Load() *Translator {
  12. translator := NewTranslator()
  13. for language, tr := range translations {
  14. logger.Debug("Loading translation: %s", language)
  15. translator.AddLanguage(language, tr)
  16. }
  17. return translator
  18. }
  19. // AvailableLanguages returns the list of available languages.
  20. func AvailableLanguages() map[string]string {
  21. return map[string]string{
  22. "en_US": "English",
  23. "fr_FR": "Français",
  24. "de_DE": "Deutsch",
  25. "pl_PL": "Polski",
  26. "zh_CN": "简体中文",
  27. "nl_NL": "Nederlands",
  28. }
  29. }