How to make Custom Fields available for translation

Laraship QuestionsCategory: Theme CustomizationHow to make Custom Fields available for translation
Martin Kutter asked 5 years ago
Hi  Custom Fields (via Backend) seems not be able to handle multiple languages. In the database there is no indication that it is supported. Maybe the only way to handle this is to choose fieldnames with the language code attached and in the front end refer to these according to the actual language shortcode:
  • my_field_name_en
  • my_field_name_de
  • my_field_name_fr
and in the front end something like this (fake code to get the idea): $getLanguageShort = 'de'; $product->getCustom( 'my_field_name_'.$getLanguageShort );   Can you confirm that? Thank you. Regards. Martin
1 Answers
laraship Staff answered 5 years ago
Hello, Not sure this is the right way, I suggest creating another column for custom fields values table and call it local and on store it will detect what is the value we stored and what is current language
Martin Kutter replied 5 years ago

Hi

I understand what you mean, but the process needs also to be able to handle the language code, the system needs to store a record for each language in the “custom_fields” table. How/where can this be accomplished?

Thanks.
Martin