BookingSync / synced

Keep your BookingSync Application synced with BookingSync
MIT License
3 stars 2 forks source link

globalized attribute leaves empty translations behind #71

Open thilonel opened 7 years ago

thilonel commented 7 years ago

... found a translation for a rental that was totally empty. Re-syncing it did not help. The core API was not returning that locale, but it was not deleted. I think it should be synced's responsibility to remove deleted locales.

ZenCocoon commented 7 years ago

@thilonel please don't like private repos, include public details needed here instead please.

thilonel commented 7 years ago

@ZenCocoon sorry, I have slipped over this public / private problem...

StoneFrog commented 7 years ago

@thilonel Don't be so selfish, share more details so I can play with it 😃

thilonel commented 7 years ago

@StoneFrog there's not much to add. Say there's a model with translated attributes, we're syncing them in two languages, en and fr. Then that locale gets removed somehow, - meaning the API won't return it anymore - but the translations won't be removed from the app. I think they should be.

Hm?

StoneFrog commented 7 years ago

@thilonel The thing is that it should work that way right now - attributes for locales not returned by api default to nil. And I'm not able to reproduce this issue, so unless you try to fetch locales with sth like translations.translated_locales I can't see what could go wrong here.

thilonel commented 7 years ago

@StoneFrog so it won't appear under model_name.translations?

StoneFrog commented 7 years ago

it will, just all attributes will be nil

thilonel commented 7 years ago

That's pretty annoying don't you think? When you try to iterate over all the translations and you find empty ones, that were deleted, then you have to handle that as well.

StoneFrog commented 7 years ago

I usally preselect locales to make sure that specific attribute is present anyway, but I can see your point. I see no downsides of such approach (like performane drop or backward incompatibility), so you can expect a PR soon, unless someone else will have objections