New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add context to translation payload when dealing with TextPlugin #452
Conversation
1 similar comment
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for sanity, I'm using the default .gitignore for python porvided by github. =]
@staticmethod | ||
def get_translation_content(field, plugin_data): | ||
def _render_plugin_with_content(obj, match): | ||
field = django_settings.DJANGOCMS_TRANSLATIONS_CONF[obj.plugin_type]['text_field_child_label'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
call the helper mentioned in my comment on translations app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should I (1) duplicate the method in this project or (2) assume djangocms-translations is installed in this context?
I would go for (2).
|
||
OBJ_ADMIN_RE_PATTERN_WITH_CONTENT = _rreplace(OBJ_ADMIN_RE_PATTERN, '.*?', '(?P<content>.*?)', 1) | ||
data = [x.groups() for x in re.finditer(OBJ_ADMIN_RE_PATTERN_WITH_CONTENT, content)] | ||
data = {int(k): v for k, v in data} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data = {int(pk): value for pk, value in data}
def _rreplace(text, old, new, count): | ||
return new.join(text.rsplit(old, count)) | ||
|
||
OBJ_ADMIN_RE_PATTERN_WITH_CONTENT = _rreplace(OBJ_ADMIN_RE_PATTERN, '.*?', '(?P<content>.*?)', 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at he cost of DRY, please make a constant with the necessary regex.
return content, subplugins_within_this_content | ||
|
||
@staticmethod | ||
def get_translation_children_content(content, plugin): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set_translation_import_content
@@ -197,6 +202,31 @@ def do_post_copy(self, instance, source_map): | |||
new_text = replace_plugin_tags(instance.body, ids_map) | |||
self.model.objects.filter(pk=instance.pk).update(body=new_text) | |||
|
|||
@staticmethod | |||
def get_translation_content(field, plugin_data): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_translation_import_content
|
||
@python_2_unicode_compatible | ||
class DummyLink(CMSPlugin): | ||
cmsplugin_ptr = models.OneToOneField( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed
test_requirements.txt
Outdated
coverage>=4.4.2 | ||
flake8>=3.0.4 | ||
|
||
-e git+ssh://git@github.com/divio/djangocms-transfer.git@master#egg=djangocms-transfer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmmm
this might be an issue on travis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any ideas here?
|
||
|
||
@unittest.skipUnless( | ||
HAS_DJANGOCMS_TRANSLATIONS and HAS_DJANGOCMS_TRANSFER and X, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is X
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
X is a stupid mistake. Shame on me. =P
No description provided.