Closed abovedave closed 6 years ago
Closes #405
You can now add the bool i18n to a datasource.json schema to enable the passing of the variable lang directly to API to filter the data by a given language.
i18n
lang
This works similarly to paginate and the param page, except i18n is enabled by default.
paginate
page
Example
articles.json
{ "datasource": { "key": "articles", "source": { "type": "dadiapi", "endpoint": "1.0/blog/articles" }, "count": 4, "paginate": true, "sort": { "publishedAt": -1 }, "requestParams": [{ "param": "title", "field": "slug" }] } }
If you don't want it passed you must explicitly set it to false.
"i18n": false
page.json
{ "page": { "key": "article" }, "datasources": [ "articles" ], "requiredDatasources": [ "articles" ], "routes": [ { "path": "/:lang/:title" } ] }
You could also forgo the url param and just use a normal query param ...?lang=en
...?lang=en
Closes #405
You can now add the bool
i18n
to a datasource.json schema to enable the passing of the variablelang
directly to API to filter the data by a given language.This works similarly to
paginate
and the parampage
, excepti18n
is enabled by default.Example
articles.json
If you don't want it passed you must explicitly set it to false.
page.json
You could also forgo the url param and just use a normal query param
...?lang=en