You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.1 KiB

  1. # frozen_string_literal: true
  2. module SettingsHelper
  3. HUMAN_LOCALES = {
  4. en: 'English',
  5. ar: 'العربية',
  6. bg: 'Български',
  7. ca: 'Català',
  8. de: 'Deutsch',
  9. eo: 'Esperanto',
  10. es: 'Español',
  11. fa: 'فارسی',
  12. fi: 'Suomi',
  13. fr: 'Français',
  14. he: 'עברית',
  15. hr: 'Hrvatski',
  16. hu: 'Magyar',
  17. id: 'Bahasa Indonesia',
  18. io: 'Ido',
  19. it: 'Italiano',
  20. ja: '日本語',
  21. ko: '한국어',
  22. nl: 'Nederlands',
  23. no: 'Norsk',
  24. oc: 'Occitan',
  25. pl: 'Polszczyzna',
  26. pt: 'Português',
  27. 'pt-BR': 'Português do Brasil',
  28. ru: 'Русский',
  29. th: 'ภาษาไทย',
  30. tr: 'Türkçe',
  31. uk: 'Українська',
  32. 'zh-CN': '简体中文',
  33. 'zh-HK': '繁體中文(香港)',
  34. 'zh-TW': '繁體中文(臺灣)',
  35. }.freeze
  36. def human_locale(locale)
  37. HUMAN_LOCALES[locale]
  38. end
  39. def hash_to_object(hash)
  40. HashObject.new(hash)
  41. end
  42. def session_device_icon(session)
  43. device = session.detection.device
  44. if device.mobile?
  45. 'mobile'
  46. elsif device.tablet?
  47. 'tablet'
  48. else
  49. 'desktop'
  50. end
  51. end
  52. end