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

User Notification System

Build a notification system that displays personalized messages with dynamic content. The system should support multiple languages and inject user-specific data into message templates.

Requirements

Your system should:

  1. Display welcome messages with the user's name inserted dynamically
  2. Show notification messages with multiple dynamic values (e.g., count and item names)
  3. Support nested data interpolation where values come from nested object properties
  4. Provide fallback values when expected data is missing

The system should support at least English and Spanish translations.

Implementation

@generates

API

/**
 * Initializes the notification system with translation resources
 * @param {Object} resources - Translation resources organized by language
 * @returns {Promise<void>}
 */
async function initNotifications(resources);

/**
 * Gets a personalized greeting with the user's name
 * @param {string} language - Language code (e.g., 'en', 'es')
 * @param {string} userName - The user's name to insert
 * @returns {string} Localized greeting with user name
 */
function getGreeting(language, userName);

/**
 * Gets a notification message with multiple dynamic values
 * @param {string} language - Language code
 * @param {Object} data - Object containing count and itemName properties
 * @returns {string} Localized notification with interpolated values
 */
function getNotification(language, data);

/**
 * Gets a message using nested object data
 * @param {string} language - Language code
 * @param {Object} data - Nested object with user.profile.name structure
 * @returns {string} Localized message with nested interpolation
 */
function getProfileMessage(language, data);

Test Cases

  • Calling getGreeting('en', 'Alice') returns "Welcome, Alice!" @test
  • Calling getGreeting('es', 'Carlos') returns "¡Bienvenido, Carlos!" @test
  • Calling getNotification('en', {count: 5, itemName: 'messages'}) returns "You have 5 new messages" @test
  • Calling getProfileMessage('en', {user: {profile: {name: 'Bob'}}}) returns a message containing "Bob" from nested data @test
  • Calling getGreeting('en', undefined) returns a greeting with a default name like "Guest" when no name is provided @test

Dependencies { .dependencies }

i18next { .dependency }

Provides internationalization with interpolation support for dynamic content in translations.

@satisfied-by

Version

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