apostrophe
apostrophe copied to clipboard
localization api returns default locale
To Reproduce
Step by step instructions to reproduce the behavior:
- Localize page content into 2 or more languges
- Request a page with
apos-locale
set to defined locale (ex:/api/v1/@apostrophecms/page/pageid?apikey=secret&apos-locale=en
)- See that results are always in default locale
Expected behavior
Should return results in requested locale
Describe the bug
apos-locale query param isn't working. when i make a request for data with
apos-locale
set, the default language is returned.
Details
The only way I've been able to request localize content is to add locale:published
to the id of my request. (ex: /api/v1/@apostrophecms/page/pageid:en:published?apikey=secret
), but even when i do, the _url for a page is still the default one not the localized one.
For example my english homepage should be /en but it's /de here.
Hi @iampeternguyen
Thank you for bringing this to our attention!
This is actually a bug in our documentation rather than in Apostrophe. When Apostrophe entered into beta, there was a decision to convert all the query parameters to camelCase to maintain consistency with the query builders. Those changes never made it into our documentation.
We plan to remedy this quickly by updating our documentation. In the meantime, you can convert your requests to /api/v1/@apostrophecms/page/pageid?apikey=secret&aposLocale=en&aposMode=published
, where the pageid is the expected one without appending the locale:published
. If you need the rendered areas use renderAreas=true
not render-areas=true
.
Sorry for the trouble and thanks again.
NOTE: leaving this open for others to find until the documentation has been updated.
ah perfect! this does exactly what i wanted.