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.
 
 
 
 

81 lines
1.7 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. cs: 'Čeština',
  11. cy: 'Cymraeg',
  12. da: 'Dansk',
  13. de: 'Deutsch',
  14. el: 'Ελληνικά',
  15. eo: 'Esperanto',
  16. es: 'Español',
  17. eu: 'Euskara',
  18. fa: 'فارسی',
  19. fi: 'Suomi',
  20. fr: 'Français',
  21. gl: 'Galego',
  22. he: 'עברית',
  23. hr: 'Hrvatski',
  24. hu: 'Magyar',
  25. hy: 'Հայերեն',
  26. id: 'Bahasa Indonesia',
  27. io: 'Ido',
  28. it: 'Italiano',
  29. ja: '日本語',
  30. ka: 'ქართული',
  31. ko: '한국어',
  32. nl: 'Nederlands',
  33. no: 'Norsk',
  34. oc: 'Occitan',
  35. pl: 'Polszczyzna',
  36. pt: 'Português',
  37. 'pt-BR': 'Português do Brasil',
  38. ro: 'Limba română',
  39. ru: 'Русский',
  40. sk: 'Slovenčina',
  41. sl: 'Slovenščina',
  42. sr: 'Српски',
  43. 'sr-Latn': 'Srpski (latinica)',
  44. sv: 'Svenska',
  45. ta: 'தமிழ்',
  46. te: 'తెలుగు',
  47. th: 'ภาษาไทย',
  48. tr: 'Türkçe',
  49. uk: 'Українська',
  50. zh: '中文',
  51. 'zh-CN': '简体中文',
  52. 'zh-HK': '繁體中文(香港)',
  53. 'zh-TW': '繁體中文(臺灣)',
  54. }.freeze
  55. def human_locale(locale)
  56. HUMAN_LOCALES[locale]
  57. end
  58. def filterable_languages
  59. LanguageDetector.instance.language_names.select(&HUMAN_LOCALES.method(:key?))
  60. end
  61. def hash_to_object(hash)
  62. HashObject.new(hash)
  63. end
  64. def session_device_icon(session)
  65. device = session.detection.device
  66. if device.mobile?
  67. 'mobile'
  68. elsif device.tablet?
  69. 'tablet'
  70. else
  71. 'desktop'
  72. end
  73. end
  74. end