Localizable field tweaks for Collections API

VERIFIED FIXED in 2013-08-27


5 years ago
5 years ago


(Reporter: basta, Assigned: mat)


Windows 7


(Whiteboard: [qa-])



5 years ago
1. Ability to get objects back for localizable fields
2. Default locale for localizable fields should be whatever's passed as "lang" parameter (if one is passed) on POST
3. Default locale should be somehow specified in localized objects when reading from the API. E.g.:

"name": {
 "en-US": "foo",
 "es": "bar",
 "__default": "en-US"

4. PATCHing a new value should overwrite the locale object entirely. If a locale is absent in the updated locale object, the locale should be removed from the field.

Comment 1

5 years ago
1) Do you want the object back everytime ? i.e., never return simple strings anymore in the API for fields that can be translated?

2) and 3) Would it make sense to have default_locale instead of lang passed at creation/edit time, and then store and return it on the Collection instances themselves ? This would be the easiest to implement I think, this matches how Translation works internally.

4) Is impossible to implement right now :/ We currently can't delete Translation instances, bug 902435 has more info about this. We could have hacks to hide empty translations or something similar if needed.

Comment 2

5 years ago
1. On one hand, no, because it's a pain in the ass. But on the other more important hand, yes, because it's consistent and I'd rather do it right than hack it :)

2-3. I only suggested the lang parameter since it's what we'd specify anyway for the default locale. It might be nice to accept it in the object for other API consumers, but having the API fall back on the parameter might be a nice convenience.

4. Empty translations should definitely be hidden. The API should treat absent localizations as hidden.


5 years ago
Priority: -- → P2
Summary: Localizable field tweaks → Localizable field tweaks for Collections API
Blocks: 894417

Comment 3

5 years ago
ok so I went with:

1. All translations should be returned everytime in the rocketfuel API. Reopen this bug if there are some places where it doesn't. We'll figure out what to do in the consumer API in bug  907820

2. and 3. `default_language` is now a parameter. It's stored on the Collection and returned in the response for every Collection object.

4. NULL translations are hidden. I'm not sure you can properly set them to NULL yet in the API though, I forgot to test that.
Last Resolved: 5 years ago
Resolution: --- → FIXED


5 years ago
Whiteboard: [qa-]
Target Milestone: --- → 2013-08-27

Comment 5

5 years ago
You need to log in before you can comment on or make changes to this bug.