SQLAlchemy translation mixin
fizyk opened this issue · comments
Grzegorz Śliwiński commented
Idea is to have a translation mixin that will be able to extend model dev want to have tranmslated with submodel that will take some of the fields from master model, and adds relation to master model and to pyramid_localize.models.Language to detect a language. We would have to mark some fields as translatable on master model (new field type?)
Rough idea of how it should look like within python
class Post(LocalizeMixin, Base):
# ....
post = Post()
assert isinstance(post.translations[0], Post.I18n)
Both Post and Post.I18n should be valid sqlalchemy.
Also Post should retrieve getitme method, that would return requested translation,
post = Post()
assert isinstance(post['en'], Post,I18n)