0

I've created a custom model named "Post". It has some fields: a title and a content. How to make these fields translatable?

More detailed question:

The Magento 2 way to translate ? products / categories is the following : from the back-office, in a product / category edit page, you have to switch from your default language store view to a localized store view (for example: French Store View to English Store View), then edit the fields you want to translate, then save your product.

How to reproduce this behavior on my custom model?

1 Answer 1

1

Implement your model as EAV model and use the store_id column of the attribute tables to save store specific values.

The devdocs don't seem to have a chapter for creating custom EAV models yet, but there are some other resources:

Code generator

(others exist but none I am aware of that can create EAV models)

Video tutorial

Relevant Stack Exchange questions

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.