A universal package for managing and rendering text templates in Node.js applications with support for multilingualism and flexible overrides. Enables easy creation of localized content for web pages, email campaigns, and any other text-based formats.
-
Multilingual Support
Automatic template selection considering user, application, and plugin locales with fallback logic. -
Flexible Override System
Allows overriding plugin templates at the application level without modifying the original code. -
Template Engine Abstraction
Supports various engines (Mustache, Nunjucks, etc.) through a unified interface, with an easily extensible architecture. -
Versatility
Suitable for generating HTML, JSON, XML, YAML, email, and other text formats. -
Easy Integration
Easily integrates with any Node.js application and can be used as a standalone module.
- Defines the target template considering type (web, email, text), name, package, and locales.
- Searches the template file in a strict order based on locales and overrides.
- Loads the found template from disk.
- Renders the template with data via the configured engine.
- Returns the ready localized content.
Applications must provide a template engine implementation that fulfills the Fl32_Tmpl_Back_Api_Engine interface. Use the DI container's replace.add() method to map Fl32_Tmpl_Back_Api_Engine$ to the desired engine service:
replace.add('Fl32_Tmpl_Back_Api_Engine$', 'Fl32_Tmpl_Back_Service_Engine_Mustache$');Available engine implementations include:
Fl32_Tmpl_Back_Service_Engine_MustacheFl32_Tmpl_Back_Service_Engine_NunjucksFl32_Tmpl_Back_Service_Engine_Simple
Custom engines can also be supplied as long as they conform to Fl32_Tmpl_Back_Api_Engine.
- Developers building multilingual web applications and mailing services.
- Teams working with plugins and complex modular architectures.
- Projects needing a flexible and extensible template system without lock-in to a specific templating engine.
Run unit tests with Node.js built-in runner:
npm testThe package is actively developed and successfully used in projects with modular architecture. It is created following the TeqFW philosophy, ensuring clear separation of concerns, modularity, and extensibility. Documentation follows the 3DP methodology, providing clear structure and separation between code, documentation, and iterations.
Apache-2.0 © Alex Gusev