Class: Spree::Api::V3::Admin::LocalesController

Inherits:
Admin::BaseController
  • Object
show all
Defined in:
app/controllers/spree/api/v3/admin/locales_controller.rb

Overview

Lists the locales a merchant can translate content into for the current store (its supported_locales_list), so the dashboard's locale switcher enumerates locales instead of hardcoding them.

Instance Method Summary collapse

Instance Method Details

#indexObject

GET /api/v3/admin/locales



12
13
14
15
16
17
18
# File 'app/controllers/spree/api/v3/admin/locales_controller.rb', line 12

def index
  render json: {
    data: current_store.supported_locales.map do |locale|
      Spree.api.locale_serializer.new(locale).to_h
    end
  }
end