MyNixOS website logo
Description

Extension to Show: templating, catalogizing, languages, parameters, etc.

"PCLT" is an abbreviation for "Parametric Composable Localizable Templates" - in fact it should also hold Detalizable. Term "Detailizable content (message)" in this package has a following meaning: some content, representing which it is possible to regulate, in how much details it is represented.

Conceptually, this package is a powerful extension to the well known Show class, that (extension) is thought to be embeded in any Haskell program, which requires multilanguage support, and/or where messages should be detailizable.

The PCLT catalog consists of:

  • Catalog ID

  • Config, which defines rules and constraints, that are used when catalog gets formed, and when it is used to generate messages.

  • Tempates of messages, possibly related. Each catalog entry is referenced by an ID, and is called "localizable (in languages) template", while it's localization in concrete language is called "localized (in a languages) template".

Each catalog entry (localizable template) consists of

  • ID

  • A requirement to detailization level (to used by reciever of representation), which if is not statisfied, the template isn't used.

  • A map of localized templates by languages - the different translations of one same message.

Each localized template is a sequence of chunks:

  • plain texts,

  • named parameters placeholders,

  • placeholders for insertion of other template (reference on other template, also called composites).

To make a message one needs to specify

  • a catalog,

  • a language,

  • detailization level to orient on

  • a localizable template ID,

  • a map of parameters together with their values.

The last two fields (localizable template ID + a map of parameters together with their values) is called instaniation (of templated message). In the program it wrapped in a PCSI data type.

A parameter value may be

  • plain text

  • newline

  • nothing

  • a reference to other instaniation (localizable template ID + a map of parameters together with their values)

  • a list of other other instaniation

  • a parameter wrapping, where wrapper is an indentation of text (N whitespaces insertion after each newline character)

  • a list of parameter values.

This package comes together with another one - a dependent package PCLT-DB (section Database), which provides

  • a (PostgreSQL 8.4) DB structure where to keep/manage data used for PCLT catalogs formation,

  • simple interface to read this data in haskell program, and

  • a prototype of a longterm service which regularly updates catalog MVar with data from DB.

IMPORTANT!!! : It is highly recommended to use ISO 639(3) standard for language names, since PCLT-DB package is oriented on 3 letters (not bigger) language names. Without modifications PCLT-DB won't work for bigger (then 3-letters) names.

ToDo considerations for the next versions:

  1. Consider using state monad in order to put catalog into an implicit context... and maybe also other uses if monads.

  2. Rewrite MakeCatalog, so that it uses CatalogMaths functions. Otherwise the both modules do similar work, and keeping double code is a bad style.

  3. Introduction of a new parameter value type: "reparsable" wrapping for parameter value.

  4. CatalogMaths extension.

  5. Enchance required SDLs with min & max functions.

  6. Sacrificing ldtSubcompositesMap of LocalizedTemplate, which initially was introduced to enchance speed of messages generation, in favor of making catalogs easier to modify (which curently isn't supported and isn't an easy task).

Metadata

Version

0.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows