Skip to content

Latest commit

 

History

History
63 lines (45 loc) · 1.79 KB

index.rst

File metadata and controls

63 lines (45 loc) · 1.79 KB

Amnesia multilingual plugin

Amnesia multilingual content plugin provides multi-language support for Content-based content types in AmnesiaCMS.

How does it work?

Entities which contain translatable fields are splitted. Non-translatable fields remain in the base entity table while translatable fields go in a dedicated table.

Usage

  1. Install package:

    pip install amnesia_multilingual
  2. Create translation table(s):

    create table amnesia_translation.document_translation (
       language_id char(2) not null,
       content_id  integer not null,
       body        text    not null,
    
       constraint pk_document_translation
           primary key(language_id, content_id),
    
       constraint fk_document_translation_content_translation
           foreign key(language_id, content_id)
           references amnesia_translation.content_translation(language_id, content_id),
    
       constraint fk_document_translation_document
           foreign key(content_id) references document(content_id)
    );
  3. Configure your application:

    def include_multilingual(config):
       config.include('amnesia_multilingual')
       config.include('amnesia_multilingual.modules.document')
       config.include('amnesia_multilingual.modules.folder')
       config.include('amnesia_multilingual.modules.event')
       config.include('amnesia_multilingual.modules.file')
    
    def main(global_config, **settings):
        config = Configurator(settings=settings, root_factory=some_root)
        config.include('amnesia')
        config.include(include_multilingual)
        config.commit()