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.
 
 
 
 

77 line
1.6 KiB

  1. # frozen_string_literal: true
  2. module SettingsHelper
  3. HUMAN_LOCALES = {
  4. en: 'English',
  5. ar: 'العربية',
  6. ast: 'l\'asturianu',
  7. bg: 'Български',
  8. ca: 'Català',
  9. co: 'Corsu',
  10. da: 'Dansk',
  11. de: 'Deutsch',
  12. el: 'Ελληνικά',
  13. eo: 'Esperanto',
  14. es: 'Español',
  15. eu: 'Euskara',
  16. fa: 'فارسی',
  17. fi: 'Suomi',
  18. fr: 'Français',
  19. gl: 'Galego',
  20. he: 'עברית',
  21. hr: 'Hrvatski',
  22. hu: 'Magyar',
  23. hy: 'Հայերեն',
  24. id: 'Bahasa Indonesia',
  25. io: 'Ido',
  26. it: 'Italiano',
  27. ja: '日本語',
  28. ka: 'ქართული',
  29. ko: '한국어',
  30. nl: 'Nederlands',
  31. no: 'Norsk',
  32. oc: 'Occitan',
  33. pl: 'Polszczyzna',
  34. pt: 'Português',
  35. 'pt-BR': 'Português do Brasil',
  36. ru: 'Русский',
  37. sk: 'Slovenčina',
  38. sl: 'Slovenščina',
  39. sr: 'Српски',
  40. 'sr-Latn': 'Srpski (latinica)',
  41. sv: 'Svenska',
  42. te: 'తెలుగు',
  43. th: 'ภาษาไทย',
  44. tr: 'Türkçe',
  45. uk: 'Українська',
  46. zh: '中文',
  47. 'zh-CN': '简体中文',
  48. 'zh-HK': '繁體中文(香港)',
  49. 'zh-TW': '繁體中文(臺灣)',
  50. }.freeze
  51. def human_locale(locale)
  52. HUMAN_LOCALES[locale]
  53. end
  54. def filterable_languages
  55. LanguageDetector.instance.language_names.select(&HUMAN_LOCALES.method(:key?))
  56. end
  57. def hash_to_object(hash)
  58. HashObject.new(hash)
  59. end
  60. def session_device_icon(session)
  61. device = session.detection.device
  62. if device.mobile?
  63. 'mobile'
  64. elsif device.tablet?
  65. 'tablet'
  66. else
  67. 'desktop'
  68. end
  69. end
  70. end