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.

56 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. nl: 'Nederlands',
  22. no: 'Norsk',
  23. oc: 'Occitan',
  24. pl: 'Polszczyzna',
  25. pt: 'Português',
  26. 'pt-BR': 'Português do Brasil',
  27. ru: 'Русский',
  28. th: 'ภาษาไทย',
  29. tr: 'Türkçe',
  30. uk: 'Українська',
  31. 'zh-CN': '简体中文',
  32. 'zh-HK': '繁體中文(香港)',
  33. 'zh-TW': '繁體中文(臺灣)',
  34. }.freeze
  35. def human_locale(locale)
  36. HUMAN_LOCALES[locale]
  37. end
  38. def hash_to_object(hash)
  39. HashObject.new(hash)
  40. end
  41. def session_device_icon(session)
  42. device = session.detection.device
  43. if device.mobile?
  44. 'mobile'
  45. elsif device.tablet?
  46. 'tablet'
  47. else
  48. 'desktop'
  49. end
  50. end
  51. end