The code powering m.abunchtell.com https://m.abunchtell.com
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.
 
 
 
 

67 lines
1.3 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. gl: 'Galego',
  13. fi: 'Suomi',
  14. fr: 'Français',
  15. he: 'עברית',
  16. hr: 'Hrvatski',
  17. hu: 'Magyar',
  18. id: 'Bahasa Indonesia',
  19. io: 'Ido',
  20. it: 'Italiano',
  21. ja: '日本語',
  22. ko: '한국어',
  23. nl: 'Nederlands',
  24. no: 'Norsk',
  25. oc: 'Occitan',
  26. pl: 'Polszczyzna',
  27. pt: 'Português',
  28. 'pt-BR': 'Português do Brasil',
  29. ru: 'Русский',
  30. sk: 'Slovensky',
  31. sr: 'Српски',
  32. sv: 'Svenska',
  33. th: 'ภาษาไทย',
  34. tr: 'Türkçe',
  35. uk: 'Українська',
  36. zh: '中文',
  37. 'zh-CN': '简体中文',
  38. 'zh-HK': '繁體中文(香港)',
  39. 'zh-TW': '繁體中文(臺灣)',
  40. }.freeze
  41. def human_locale(locale)
  42. HUMAN_LOCALES[locale]
  43. end
  44. def filterable_languages
  45. LanguageDetector.instance.language_names.select(&HUMAN_LOCALES.method(:key?))
  46. end
  47. def hash_to_object(hash)
  48. HashObject.new(hash)
  49. end
  50. def session_device_icon(session)
  51. device = session.detection.device
  52. if device.mobile?
  53. 'mobile'
  54. elsif device.tablet?
  55. 'tablet'
  56. else
  57. 'desktop'
  58. end
  59. end
  60. end