Get all available locales?

I’ve gone through the docs, but cannot find an API-endpoint where all the available locales is available. I.e. the locales that is setup under Internationalization.

I can get all translations for a specific content type with

baseAddress/{content-type}?_locale=all 

But I would like to get a response with all available locales from the API. Is there a way?

Hi Hope I understand your question correctly.
tried the following:
baseAddress/i18n/locales
remember to allow the role: listlocales to allow for this request

2 Likes

Yes, exactly what I was looking for. Thanks!

Hey,

That’s the solution I was looking for as well. Prior to that one, I had to query DB directly via knex.
But … I was wondering if it is possible to get the list of locales via GraphQL. It is quite awkward to see a ton of tutorials how to create / update a localized content, but no word on how to get the list of locales, which to my mind should be the first question to answer. Otherwise, how on earth would you be listing the available languages on your website???

In case it is not possible to query the list of locales via graphql, I guess it should be added / implemented.

strapi.query('locale', 'i18n').find()

I think it is strapi.db.query now
But how can i access ‘strapi’ in angular ?
what is the package name to import ‘strapi’ in angular component?

on 4.11.2 i’m use from {{host}}/api/i18n/locales