Skip to content
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

Objects partially losing translation #422

Open
achimwilde opened this issue Jun 26, 2023 · 2 comments
Open

Objects partially losing translation #422

achimwilde opened this issue Jun 26, 2023 · 2 comments

Comments

@achimwilde
Copy link

achimwilde commented Jun 26, 2023

We have a big Plone 5 website with about 50 languages and about 330,000 objects total. Recently, a few of the PAM translated objects are not symmetric anymore - object A is still a translation of object B, but object B is not a translation of object A anymore. It's pretty rare, but it happened 3 or 4 times in the last months. Anyone having similar problems?

To check we use the following script in debug mode ("bin/client1 -O Plone debug"):

from plone import api
from plone.app.multilingual.interfaces import ITranslationManager
from sys import stdout
brains = api.content.find(path='/')
anzahl = len(brains)
ausgabe = ''
for i,brain in enumerate(brains):
  stdout.write('\r'+' '*len(ausgabe)+'\r')
  try:
    obj = brain.getObject()
  except KeyError as e:
    print ('WARN: No objekt for brain %s found' % (brain.getPath()))
    continue
  ausgabe = '%s/%s %s percent %s' % (i+1,anzahl,round(float(i)/anzahl*100,2),repr(obj))
  stdout.write(ausgabe)
  stdout.flush()
  sprachversion_obj = obj.Language()
  translations = ITranslationManager(obj).get_translations()
  for sprachversion_uebersetzung in translations:
    if sprachversion_uebersetzung == '':
      continue
    if not ITranslationManager(translations[sprachversion_uebersetzung]).has_translation(sprachversion_obj):
      print (u'ERROR: No translation from %s to %s for %s' % (sprachversion_uebersetzung,sprachversion_obj,repr(obj)))


@davisagli
Copy link
Member

@achimwilde I think I've seen this happen if there are two items in the same translation group with the same language. (In other words, one of the items has the wrong language for its language root folder.)

@achimwilde
Copy link
Author

Thank you for this hint. We've had a few such objects in the website, but those weren't the same as the ones that were half-connected. We are now making sure to explicitly set the language in new objects. Hopefully this will solve the other problem, though I am not very confident about that...

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

No branches or pull requests

2 participants