Skip to content

Developer Mode

Kenny Mochizuki Escalona edited this page Aug 16, 2026 · 1 revision

Developer Mode

Enabling Developer Mode

Enable developer mode to display debug information instead of actual translations. This is useful for verifying that your app is correctly using translation keys and arguments.

// Enable developer mode
LayrzI18n.setDeveloperMode(true);

// Disable developer mode (default)
LayrzI18n.setDeveloperMode(false);

Developer mode is a static, global flag that affects all LayrzI18n instances in your app.

Debug Output Format

When developer mode is enabled, each translation method returns a debug string instead of the actual translation:

t(key, args) — Plain Text

// Normal: 'Hello, Alice!'
// Developer mode: 'greeting : {"name":"Alice"}'
i18n.t('greeting', {'name': 'Alice'})

Returns the translation key, followed by : and the JSON-encoded argument map.

tc(key, count, args) — Pluralization

// Normal: '5 items'
// Developer mode: 'items|5 : {"count":"5"}'
i18n.tc('items', 5, {'count': '5'})

Returns the translation key, followed by |, the count value, and the JSON-encoded argument map.

te(key, args, richArgs, style) — Rich Text

// Normal: TextSpan with rendered rich text
// Developer mode: TextSpan with text 'greeting : args: {"name":"Alice"} | richArgs.keys: [text]'
i18n.te('greeting', args: {'name': 'Alice'}, richArgs: {'text': TextSpan(...)})

Returns a TextSpan containing the translation key, plain arguments (JSON-encoded), and rich argument keys (comma-separated).

tce(key, count, args, richArgs, style) — Rich Text + Pluralization

// Normal: TextSpan with rendered rich text
// Developer mode: TextSpan with text 'items | 5 : args: {"count":"5"} | richArgs.keys: [units]'
i18n.tce('items', 5, args: {'count': '5'}, richArgs: {'units': TextSpan(...)})

Returns a TextSpan containing the translation key, count, plain arguments (JSON-encoded), and rich argument keys (comma-separated).

Use Cases

Developer mode helps you:

  • Verify key usage: Quickly check whether the app is using the correct translation keys
  • Debug arguments: Ensure arguments are being passed correctly to translation methods
  • Identify missing translations: See which keys are being requested but may not exist in your backend
  • Test layout with long strings: Debug strings display the raw message structure without interpolation

Disable developer mode before shipping to production.