Skip to content

Conversation

danielvdp
Copy link
Collaborator

@danielvdp danielvdp commented Jul 20, 2021

This PR adds customizable labels to the TranslationModelForm as Meta options.

Fixes: #70

@danielvdp danielvdp force-pushed the feature/translation-form-customizable-labels branch from f58ffc8 to 7b53162 Compare July 20, 2021 16:27
@danielvdp danielvdp marked this pull request as ready for review July 20, 2021 16:30
Comment on lines +251 to +252
fallback_label = "default language"
translation_label = "new language"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or do we prefer something more compact like:

Suggested change
fallback_label = "default language"
translation_label = "new language"
labels = {"fallback_label": "default language", "translation_label": "new language"}

Comment on lines +21 to +24
self.labels = {
"fallback": getattr(options, "fallback_label", _("fallback language")),
"translation": getattr(options, "translation_label", _("translation language")),
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the more compact version, this would become

Suggested change
self.labels = {
"fallback": getattr(options, "fallback_label", _("fallback language")),
"translation": getattr(options, "translation_label", _("translation language")),
}
labels = getattr(options, "labels", {})
self.labels = {
"fallback": labels.get("fallback_label", _("fallback language")),
"translation": labels.get("translation_label", _("translation language")),
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Future: add method to customize labels of translation and fallback fields
1 participant