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-2/

Multi-Language Application Settings Manager

Build a settings manager for a multi-language application that properly initializes an internationalization system with support for multiple languages, namespaces, and fallback behavior.

Requirements

Your task is to implement a settings manager that:

  1. Initializes the internationalization system with English as the default language and support for Spanish and French
  2. Configures two separate namespaces: "common" for general UI text and "settings" for settings-specific text
  3. Sets up a fallback language chain so that if a translation is missing in the current language, it falls back to English
  4. Preloads all three supported languages during initialization
  5. Enables debug mode to help with development
  6. Returns the initialized instance for use by other parts of the application

Implementation

@generates

API

/**
 * Initializes and returns a configured i18n instance for the application.
 *
 * The instance should be configured with:
 * - Default language: 'en'
 * - Supported languages: ['en', 'es', 'fr']
 * - Namespaces: ['common', 'settings'] with 'common' as default
 * - Fallback language: 'en'
 * - Debug mode: enabled
 * - All languages preloaded
 *
 * @returns {Promise<Object>} A promise that resolves to the initialized i18n instance
 */
async function initializeI18n() {
  // IMPLEMENTATION HERE
}

module.exports = {
  initializeI18n
};

Test Cases

  • The initialization function returns a promise that resolves to an i18n instance @test
  • The initialized instance has English ('en') as the current language @test
  • The initialized instance supports the 'common' and 'settings' namespaces @test
  • When a translation key is missing in Spanish, it falls back to the English translation @test

Dependencies { .dependencies }

i18next { .dependency }

Provides internationalization framework with translation, configuration, and language management capabilities.

Version

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