Closed Bug 907181 Opened 11 years ago Closed 11 years ago

Localizable field tweaks for Collections API

Categories

(Marketplace Graveyard :: API, defect, P2)

Avenir
x86_64
Windows 7
defect

Tracking

(Not tracked)

VERIFIED FIXED
2013-08-27

People

(Reporter: basta, Assigned: mat)

References

Details

(Whiteboard: [qa-])

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.
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.
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.
Priority: -- → P2
Summary: Localizable field tweaks → Localizable field tweaks for Collections API
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.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [qa-]
Target Milestone: --- → 2013-08-27
Verified
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.