messages.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package views
  2. import (
  3. "net/http"
  4. "github.com/qor5/x/i18n"
  5. )
  6. const I18nLocalizeKey i18n.ModuleKey = "I18nLocalizeKey"
  7. type Messages struct {
  8. Localize string
  9. LocalizeFrom string
  10. LocalizeTo string
  11. SuccessfullyLocalized string
  12. Location string
  13. Colon string
  14. International string
  15. China string
  16. Japan string
  17. }
  18. var Messages_en_US = &Messages{
  19. Localize: "Localize",
  20. LocalizeFrom: "From",
  21. LocalizeTo: "To",
  22. SuccessfullyLocalized: "Successfully Localized",
  23. Location: "Location",
  24. Colon: ":",
  25. International: "International",
  26. China: "China",
  27. Japan: "Japan",
  28. }
  29. var Messages_zh_CN = &Messages{
  30. Localize: "本地化",
  31. LocalizeFrom: "从",
  32. LocalizeTo: "到",
  33. SuccessfullyLocalized: "本地化成功",
  34. Location: "地区",
  35. Colon: ":",
  36. International: "全球",
  37. China: "中国",
  38. Japan: "日本",
  39. }
  40. var Messages_ja_JP = &Messages{
  41. Localize: "ローカライズ",
  42. LocalizeFrom: "から",
  43. LocalizeTo: "に",
  44. SuccessfullyLocalized: "ローカライズに成功しました",
  45. Location: "場所",
  46. Colon: ":",
  47. International: "インターナショナル",
  48. China: "中国",
  49. Japan: "日本",
  50. }
  51. func MustGetTranslation(r *http.Request, key string) string {
  52. return i18n.T(r, I18nLocalizeKey, key)
  53. }