~cytrogen/masto-fe

ref: 3a4d3e9d4b573c400eec1743471d54cdccae50a5 masto-fe/app/presenters/language_presenter.rb -rw-r--r-- 313 bytes
3a4d3e9d — Daniel M Brasil Add `GET /api/v1/instance/languages` to REST API (#24443) 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

class LanguagePresenter < ActiveModelSerializers::Model
  attributes :code, :name, :native_name

  def initialize(code)
    super()

    @code = code
    @item = LanguagesHelper::SUPPORTED_LOCALES[code]
  end

  def name
    @item[0]
  end

  def native_name
    @item[1]
  end
end