django-mapentity icon indicating copy to clipboard operation
django-mapentity copied to clipboard

Adding modeltranslation languages does not work with Default values

Open LePetitTim opened this issue 1 year ago • 0 comments

Model translation does not allow to add a new language whenever we want to add a new one. Configuration for languages is static and should not be updated. When we want to add a new language, we use the command sync_translation_fields which is used normally to add translations on new fields. This command is not made for our use case. If there is a default value (for example a boolean field), the command does not work on this field.

Solution :

Add default values management in settings (we can change the behavior for each users) Overload the sync_translation_fields for adding default values management: https://github.com/deschler/django-modeltranslation/blob/0735755070df9e96c2e745a463518fda7f02e3c7/modeltranslation/management/commands/sync_translation_fields.py#L145

LePetitTim avatar Mar 06 '23 12:03 LePetitTim