I’m evaluating Cockpit as a technology option for a project within my company, so please bear with me as I am very new to this CMS.
I require localization for all of my collections, but it is imperative that each language have only the localized fields returned in a query.
For example, I have the following collection:
test:
{
"fields": {
"field1": {
"name": "field1",
"type": "text",
"localize": true,
"options": []
},
"field2": {
"name": "field2",
"type": "text",
"localize": true,
"options": []
}
},
"entries": [
{
"field1": "field1",
"field1_ar": null,
"field1_cz": null,
"field1_de": null,
"field1_es": null,
"field1_fr": null,
"field1_it": null,
"field1_ko": null,
"field1_pt": null,
"field1_pt_pt": null,
"field1_rs": null,
"field1_ru": null,
"field1_zh": null,
"field2": "field2",
"field2_ar": null,
"field2_cz": null,
"field2_de": null,
"field2_es": null,
"field2_fr": null,
"field2_it": null,
"field2_ko": null,
"field2_pt": null,
"field2_pt_pt": null,
"field2_rs": null,
"field2_ru": null,
"field2_zh": null,
"_mby": "61a67210deabe10dfc011971",
"_by": "61a67210deabe10dfc011971",
"_modified": 1638318657,
"_created": 1638318657,
"_id": "61a6c24181223962be33f4a1"
}
],
"total": 1
}
When I call http://localhost:8081/api/collections/get/test?lang=en I get the following, which is as intended (I’ve aliased the default lang as ‘en’):
{
"fields": {},
"entries": [
{
"field1": "field1",
"field2": "field2",
"_mby": "61a67210deabe10dfc011971",
"_by": "61a67210deabe10dfc011971",
"_modified": 1638318657,
"_created": 1638318657,
"_id": "61a6c24181223962be33f4a1"
}
],
"total": 1
}
But when I call http://localhost:8081/api/collections/get/test?lang=cz I get the exact same response, when I want:
{
"fields": {},
"entries": [
{
"field1": null,
"field2": null,
"_mby": "61a67210deabe10dfc011971",
"_by": "61a67210deabe10dfc011971",
"_modified": 1638318657,
"_created": 1638318657,
"_id": "61a6c24181223962be33f4a1"
}
],
"total": 1
}
I assume that if I do not fill in the default language and create an English localization I will achieve the results I am looking for, as long as I leave the defaults as null. Unfortunately, I am dealing with a user base I am unable to train, and our system relies on these null values.
Is there a way to prevent this behaviour? Alternatively, is there a way to disable the “Default” language for my GUI users?
Thank you,
Nick