CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-i18next-client

tessl install tessl/npm-i18next-client@1.11.0

DEPRECATED client-side JavaScript internationalization library with translation, pluralization, and localization support.

Agent Success

Agent success rate when using this tile

69%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.08x

Baseline

Agent success rate without this tile

64%

task.mdevals/scenario-7/

Markdown Text Processor

Create a translation system that supports custom post-processing transformations on translated text. The system should allow registering custom post-processors that can transform translation outputs in various ways.

Requirements

Build a translation module that:

  1. Initializes with translation resources containing markdown-style text
  2. Supports registering custom post-processors that transform translated strings
  3. Applies post-processors to translation output when specified
  4. Supports chaining multiple post-processors in sequence
  5. Passes translation context (key, options) to post-processors

Test Cases

  • When translating a string with a registered markdown post-processor, it converts markdown syntax to HTML tags @test
  • When translating with multiple post-processors, they are applied sequentially in order @test
  • When a post-processor is not specified in options, the translation returns without post-processing @test

Implementation

@generates

API

/**
 * Initializes the translation system with resources and configuration.
 *
 * @param {Object} options - Configuration options
 * @param {Object} options.resources - Translation resources by language and namespace
 * @param {string} options.lng - Default language code
 * @param {Function} callback - Optional callback called when initialization completes
 */
function init(options, callback) {
  // IMPLEMENTATION HERE
}

/**
 * Registers a custom post-processor that transforms translation output.
 *
 * @param {string} name - The name of the post-processor
 * @param {Function} processor - Function that receives (value, key, options, translator) and returns transformed string
 */
function addPostProcessor(name, processor) {
  // IMPLEMENTATION HERE
}

/**
 * Translates a key and applies any specified post-processors.
 *
 * @param {string} key - The translation key
 * @param {Object} options - Translation options including postProcess property
 * @returns {string} The translated and post-processed string
 */
function t(key, options) {
  // IMPLEMENTATION HERE
}

module.exports = {
  init,
  addPostProcessor,
  t
};

Dependencies { .dependencies }

i18next { .dependency }

Provides internationalization support with post-processing capabilities.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/i18next-client@1.11.x
tile.json